コード例 #1
0
ファイル: LoginType.php プロジェクト: radicalsuz/amp
 function check_authen_credentials()
 {
     // First check for an existing authentication token.
     if (isset($_COOKIE[$this->_cookie_name])) {
         $this->notice('cookie exists');
         if ($result = $this->_handler->check_cookie($_COOKIE[$this->_cookie_name])) {
             return $result;
         }
     }
     //Check for a temporary auth token
     if (isset($_GET[$this->_cookie_name]) && isset($_GET['authtype']) && $_GET['authtype'] == 'temp') {
         if ($result = $this->_handler->check_cookie($_GET[$this->_cookie_name])) {
             $cookie_bits = explode(':', $_GET[$this->_cookie_name]);
             $hash = $cookie_bits[0];
             $this->_handler->set_authen_tokens();
             $this->_dbcon->Execute('DELETE FROM users_sessions where hash=' . $this->_dbcon->qstr($hash));
             if (isset($_GET['auth_action']) && $_GET['auth_action'] == 'reset') {
                 trigger_error('redirecting to :' . AMP_url_update('/system/' . AMP_SYSTEM_URL_USER, array('id' => $this->_handler->userid, 'action' => 'reset')));
                 ampredirect(AMP_url_update('/system/' . AMP_SYSTEM_URL_USER, array('id' => $this->_handler->userid, 'action' => 'reset')));
                 exit;
             }
             return $result;
         }
     }
     if (isset($_REQUEST[$this->_login_username_field]) || isset($_SERVER['PHP_AUTH_USER'])) {
         $this->notice('checking password');
         return $this->_handler->check_password();
     }
     $this->error('neither cookie nor password found');
     return false;
 }
コード例 #2
0
ファイル: FAQ.php プロジェクト: radicalsuz/amp
 function get_url_edit()
 {
     if (!(isset($this->id) && $this->id)) {
         return AMP_SYSTEM_URL_FAQ;
     }
     return AMP_url_update(AMP_SYSTEM_URL_FAQ, array('id' => $this->id));
 }
コード例 #3
0
function nav_articles_by_date()
{
    $page =& AMPContent_Page::instance();
    if ($class = $page->getClassId()) {
        $date_values = AMP_lookup('classArticlesByDate', $class);
    } else {
        $date_values = AMP_lookup('articlesByDate');
    }
    if (!$date_values) {
        return false;
    }
    $output = array();
    $renderer = AMP_get_renderer();
    foreach ($date_values as $pretty_date => $qty) {
        $real_date = strtotime($pretty_date);
        $url['year'] = date('Y', $real_date);
        $url['month'] = date('m', $real_date);
        $url['offset'] = false;
        $url['qty'] = false;
        $new_url = AMP_url_update($_SERVER['REQUEST_URI'], $url);
        $output[] = $renderer->link($new_url, $pretty_date, array('class' => AMP_CONTENT_CSS_CLASS_NAV_LINK));
        if (count($output) == AMP_CONTENT_NAV_ARCHIVE_LIMIT) {
            break;
        }
    }
    return join($renderer->newline(), $output);
}
コード例 #4
0
 function onDelete(&$controller, $args = array())
 {
     $model = $controller->get_model();
     $nav_layout = $model->getLayoutId();
     if ($nav_layout) {
         ampredirect(AMP_url_update(AMP_SYSTEM_URL_NAV_LAYOUT, array('id' => $nav_layout)));
     }
 }
コード例 #5
0
ファイル: Admin.inc.php プロジェクト: radicaldesigns/amp
 function temp_auth_actions()
 {
     if (isset($_GET['auth_action']) && $_GET['auth_action'] == 'reset') {
         trigger_error('redirecting to :' . AMP_url_update('/system/' . AMP_SYSTEM_URL_USER, array('id' => $this->_handler->userid, 'action' => 'reset')));
         ampredirect(AMP_url_update('/system/' . AMP_SYSTEM_URL_USER, array('id' => $this->_handler->userid, 'action' => 'reset')));
         exit;
     }
 }
コード例 #6
0
ファイル: Detail.php プロジェクト: radicaldesigns/amp
 function render_url_for_scaled($source, $width_limit)
 {
     if ($source->width <= $width_limit) {
         return $this->render_url_for($source);
     }
     $img_class = end(split(DIRECTORY_SEPARATOR, dirname($source->getPath())));
     return AMP_url_update(AMP_CONTENT_URL_IMAGE, array('filename' => $source->getName(), 'class' => $img_class, 'action' => 'resize', 'width' => $width_limit));
 }
コード例 #7
0
ファイル: XmlSitemap.php プロジェクト: radicaldesigns/amp
 function buildUrlArray()
 {
     foreach ($this->section_keys as $id) {
         $this->urls[] = AMP_url_update(AMP_CONTENT_URL_LIST_SECTION, array('type' => $id));
     }
     foreach ($this->article_keys as $id) {
         $this->urls[] = AMP_url_update(AMP_CONTENT_URL_ARTICLE, array('id' => $id));
     }
 }
コード例 #8
0
ファイル: Location.php プロジェクト: radicaldesigns/amp
 function get_url_edit()
 {
     $badge = $this->getBadgeId();
     if ($badge) {
         return AMP_url_update(AMP_SYSTEM_URL_BADGE, array('id' => $badge));
     }
     $nav = $this->getNavId();
     if ($nav) {
         return AMP_url_update(AMP_SYSTEM_URL_NAV, array('id' => $nav));
     }
     return false;
 }
コード例 #9
0
ファイル: Blog.php プロジェクト: radicaldesigns/amp
 function render_sections($source)
 {
     $section_list = $this->load_live_sections($source);
     $sections = array();
     foreach ($section_list as $section_id => $section_name) {
         $sections[] = $this->_renderer->link(AMP_url_update(AMP_CONTENT_URL_LIST_CLASS, array('type' => $section_id, 'class' => AMP_CONTENT_CLASS_BLOG)), $section_name);
     }
     $result = join(", ", $sections);
     if (!$result) {
         return false;
     }
     return AMP_TEXT_POSTED_IN . $this->_renderer->space() . $result;
 }
コード例 #10
0
ファイル: List.inc.php プロジェクト: radicaldesigns/amp
 function _dbEdit($source, $column_name)
 {
     $db_images = AMP_lookup('db_images');
     if (!$db_images) {
         return false;
     }
     $image_db_id = array_search($source->getName(), $db_images);
     if ($image_db_id === FALSE) {
         return false;
     }
     $renderer =& $this->_getRenderer();
     return $renderer->link(AMP_url_update(AMP_SYSTEM_URL_IMAGES, array('id' => $image_db_id)), AMP_TEXT_EDIT);
 }
コード例 #11
0
ファイル: Form.inc.php プロジェクト: radicaldesigns/amp
 function render_nav_links($data, $fieldname)
 {
     if (!(isset($data['id']) && $data['id'])) {
         return false;
     }
     $linked_navs = AMP_lookup('navs_by_badge', $data['id']);
     if (!$linked_navs) {
         return false;
     }
     $renderer = AMP_get_renderer();
     foreach ($linked_navs as $id => $name) {
         $links[$id] = $renderer->link(AMP_url_update(AMP_SYSTEM_URL_NAV, array('id' => $id)), $name);
     }
     return 'Linked Navs:' . $renderer->UL($links);
 }
コード例 #12
0
ファイル: Form.inc.php プロジェクト: radicaldesigns/amp
 function link_to_layouts($data, $fieldname)
 {
     if (!(isset($data['id']) && $data['id'])) {
         return false;
     }
     $linked_layouts = AMP_lookup('nav_layouts_by_nav', $data['id']);
     if (!$linked_layouts) {
         return false;
     }
     $renderer = AMP_get_renderer();
     asort($linked_layouts);
     foreach ($linked_layouts as $id => $name) {
         if (!$name) {
             continue;
         }
         $links[$id] = $renderer->link(AMP_url_update(AMP_SYSTEM_URL_NAV_LAYOUT, array('id' => $id)), $name);
     }
     return 'Used in Layouts:' . $renderer->UL($links, array('class' => 'linked_items'));
 }
コード例 #13
0
ファイル: List.php プロジェクト: radicaldesigns/amp
 function _init_criteria()
 {
     if (!isset($this->_pager)) {
         return;
     }
     $pager_target = false;
     $section = isset($this->_source_criteria['section']) && $this->_source_criteria['section'] && !is_array($this->_source_criteria['section']) ? $this->_source_criteria['section'] : false;
     $class = isset($this->_source_criteria['class']) && $this->_source_criteria['class'] && !is_array($this->_source_criteria['class']) ? $this->_source_criteria['class'] : false;
     if ($section && $class) {
         $pager_target = AMP_url_update(AMP_CONTENT_URL_LIST_CLASS, array('type' => $section, 'class' => $class));
     } elseif ($section) {
         $pager_target = AMP_url_update(AMP_CONTENT_URL_LIST_SECTION, array('type' => $section));
     } elseif ($class) {
         $pager_target = AMP_url_update(AMP_CONTENT_URL_LIST_CLASS, array('class' => $class));
     }
     if ($pager_target) {
         $this->_pager->set_target($pager_target);
     }
 }
コード例 #14
0
ファイル: Archive.php プロジェクト: radicalsuz/amp
 function restore()
 {
     $target_id = $this->getData('id');
     if (!$target_id) {
         return false;
     }
     require_once 'AMP/Content/Template.inc.php';
     $template =& new AMPContent_Template($this->dbcon, $target_id);
     $template->save_version();
     $template->mergeData($this->getData());
     $result = $template->save();
     if (!$result) {
         return false;
     }
     AMP_flush_common_cache();
     $flash =& AMP_System_Flash::instance();
     $flash->add_message(sprintf(AMP_TEXT_DATA_RESTORE_SUCCESS, $this->getName()));
     ampredirect(AMP_url_update(AMP_SYSTEM_URL_TEMPLATE, array('id' => $target_id)));
     return $result;
 }
コード例 #15
0
ファイル: Read.inc.php プロジェクト: radicalsuz/amp
 function _make_event_list_field()
 {
     $uid = $this->udm->uid;
     if (!$uid) {
         $uid = isset($_REQUEST['uid']) ? $_REQUEST['uid'] : false;
     }
     if (!$uid) {
         return;
     }
     $events = AMP_lookup('eventsByOwner', $uid);
     if (!$events) {
         return;
     }
     $event_list = '';
     $renderer = AMP_get_renderer();
     foreach ($events as $event_id => $event_name) {
         $event_list .= $renderer->link(AMP_url_update(AMP_SYSTEM_URL_EVENT, array('id' => $event_id)), $event_name) . $renderer->newline();
     }
     $this->fields['events_list'] = array('type' => 'static', 'enabled' => true, 'default' => $event_list, 'public' => false);
     $this->fields['events_list_header'] = array('type' => 'header', 'label' => 'All Events Created By this User', 'public' => false, 'enabled' => true);
     $this->insertAfterFieldOrder(array('events_list_header', 'events_list'));
 }
コード例 #16
0
ファイル: MainMenu.php プロジェクト: radicaldesigns/amp
 function nav_sub_section($type, $sort)
 {
     $finder = new Section(AMP_Registry::getDbcon());
     if (isset($sort) && $sort) {
         $finder_source =& $finder->getSearchSource();
         $finder_source->addSort($sort);
     }
     $sections = $finder->find(array('parent' => $type, 'displayable' => '1'));
     if (!$sections) {
         return;
     }
     $html = '<ul>';
     foreach ($sections as $section) {
         if (AMP_CONTENT_HUMANIZE_URLS) {
             $sectionURL = AMP_url_update('section.php', array('id' => $section->id));
         } else {
             $sectionURL = 'section.php?id=' . $section->id;
         }
         $html .= '<li><a href="' . $sectionURL . '">' . $section->getName() . '</a><img src="img/spacer.gif" height="4" width="3" align="left"> </li>';
     }
     $html .= '</ul>';
     return $html;
 }
コード例 #17
0
/**
 * amp_badge_articles archive
 * class: default( blank ) set to a value to limit the archive to one class ( accepts comma-separated set )
 * limit: default( 24 ) set a max # of links to archived months. 2 years is the max and the default.
 */
function amp_badge_articles_archive($options)
{
    $renderer = AMP_get_renderer();
    $class = isset($options['class']) && $options['class'] ? $options['class'] : false;
    $limit = isset($options['limit']) && $options['limit'] ? $options['limit'] : 24;
    $articles_archive = $class ? AMP_lookup('article_archives_by_month_by_class', $class) : AMP_lookup('article_archives_by_month');
    if (!$articles_archive) {
        return false;
    }
    $articles_archive = array_slice(array_keys($articles_archive), 0, $limit);
    $links = array();
    $url_vars = array();
    if ($class) {
        $url_vars['class'] = $class;
    }
    foreach ($articles_archive as $date) {
        $datetime = strtotime($date);
        $url_vars['date[M]'] = date('m', $datetime);
        $url_vars['date[Y]'] = date('Y', $datetime);
        $links[] = $renderer->link(AMP_url_update('list.php', $url_vars), $date);
    }
    return $renderer->UL($links, array('class' => 'article-archives'));
}
コード例 #18
0
ファイル: Save.inc.php プロジェクト: radicalsuz/amp
 function &to_akismet($item_data)
 {
     $false = false;
     if (!AKISMET_KEY) {
         return $false;
     }
     $options = $this->getOptions();
     if (isset($options['akismet_body_field']) && $options['akismet_body_field']) {
         return $false;
     }
     $all_data = $this->udm->getData();
     if (!isset($all_data[$options['akismet_body_field']])) {
         return $false;
     }
     $body_field = $all_data[$options['akismet_body_field']];
     $ak_data = array();
     $ak_data['author'] = $item_data['First_Name'] . ' ' . $item_data['Last_Name'];
     $ak_data['email'] = $item_data['Email'];
     $ak_data['type'] = 'form_input';
     $ak_data['website'] = $item_data['Website'];
     $ak_data['body'] = $item_data[$body_field];
     $ak_data['permalink'] = isset($item_data['modin']) && $item_data['modin'] ? AMP_url_update(AMP_SITE_URL . '/' . AMP_CONTENT_URL_FORM, array('modin' => $item_data['modin'])) : false;
     require_once 'akismet/akismet.class.php';
     $akismet = new Akismet(AMP_SITE_URL, AKISMET_KEY, $ak_data);
     if ($akismet->isError(AKISMET_SERVER_NOT_FOUND)) {
         trigger_error('Akismet: Server Not Found');
         return $false;
     }
     if ($akismet->isError(AKISMET_RESPONSE_FAILED)) {
         trigger_error('Akismet: Response Failed');
         return $false;
     }
     if ($akismet->isError(AKISMET_INVALID_KEY)) {
         trigger_error('Akismet: Invalid Key');
         return $false;
     }
     return $akismet;
 }
コード例 #19
0
ファイル: List.php プロジェクト: radicaldesigns/amp
 function do_request()
 {
     if (!$this->_request->execute()) {
         return false;
     }
     if (!AMP_DISPLAYMODE_DEBUG) {
         ampredirect(AMP_url_update($_SERVER['REQUEST_URI']));
     }
     if ($affected_qty = $this->_request->getAffectedQty()) {
         $this->message(sprintf(AMP_TEXT_LIST_ACTION_SUCCESS, ucfirst(AMP_PastParticiple($this->_request->getPerformedAction())), $affected_qty));
         AMP_flush_common_cache();
     } else {
         $this->message(sprintf(AMP_TEXT_LIST_ACTION_FAIL, AMP_PastParticiple($this->_request->getPerformedAction())));
     }
     $this->_after_request();
 }
コード例 #20
0
ファイル: Detail.php プロジェクト: radicaldesigns/amp
 function render_comments($source)
 {
     if (!$source->allowsComments()) {
         return false;
     }
     require_once 'AMP/Content/Article/Comment/Public/List.php';
     $comments = new Article_Comment_Public_List(null, array('article' => $source->id));
     $comment_header = '<p class="subtitle comment_header"><a name="comments"></a>Comments</p>';
     $add_link = $this->_renderer->link(AMP_url_update(AMP_CONTENT_URL_COMMENT_ADD, array('articleid' => $source->id)), AMP_TEXT_ADD_A_COMMENT);
     return $comment_header . $comments->execute() . ($source->acceptingNewComments() ? $add_link : $this->_renderer->p(AMP_TEXT_COMMENTS_CLOSED));
 }
コード例 #21
0
ファイル: Image.php プロジェクト: radicaldesigns/amp
 function get_url_edit()
 {
     if ($db_id = $this->db_id()) {
         return AMP_url_update(AMP_SYSTEM_URL_IMAGE_EDIT, array("id" => $db_id));
     }
     $file_name = $this->id;
     if (!$file_name || $file_name == 'downloads') {
         return AMP_url_update(AMP_SYSTEM_URL_IMAGES, array('action' => 'new'));
     }
     return AMP_url_update(AMP_SYSTEM_URL_IMAGES, array("file" => $file_name, 'action' => 'new'));
 }
コード例 #22
0
ファイル: Pager.php プロジェクト: radicaldesigns/amp
 function render_all()
 {
     if ($this->_qty_page >= $this->_qty_total || $this->_qty_page_internal && $this->_qty_page >= $this->_qty_page_internal) {
         return false;
     }
     $url = AMP_url_update($this->url_offset(), array('all' => '1', 'offset' => '', 'qty' => ''));
     return $this->_renderer->link($url, $this->_renderer->double_arrow_left() . $this->_renderer->space() . $this->_text_all . $this->_renderer->space() . $this->_renderer->double_arrow_right(), array('class' => $this->_css_class_link));
 }
コード例 #23
0
function AMP_route_for($type, $id, $options = array())
{
    $route = AMP_url_update(constant(strtoupper("AMP_CONTENT_URL_{$type}")), array('id' => $id));
    if (empty($options)) {
        return $route;
    }
    if (isset($options['preview']) && $options['preview']) {
        #if( strpos( $route,'.php')) {
        return AMP_url_add_vars($route, array('preview=1', 'cache=0'));
        #}
    }
    return $route;
}
コード例 #24
0
ファイル: article.php プロジェクト: radicaldesigns/amp
    }
    //check to make sure parent section is live
    require_once 'AMP/Content/Section.inc.php';
    $currentSection = new Section(AMP_Registry::getDbcon(), $currentArticle->getParent());
    if (!AmpUtility::display_okay($currentSection)) {
        AMP_make_404();
    }
    /**
     * Check if specified article is a section header and redirect to that section
     */
    if (AMP_CONTENT_REDIRECT_SECTIONHEADERS_TO_SECTIONS && $currentArticle->getClass() == AMP_CONTENT_CLASS_SECTIONHEADER) {
        if ($currentSection->hasData()) {
            //drop article id, keep preview or other url vars
            $new_params = $_GET;
            unset($new_params['id']);
            ampredirect(AMP_url_update($currentSection->getURL(), $new_params));
        }
    }
}
/**
 * Check Section List pages for a redirect in the SectionHeader 
 */
if ($currentPage->isList(AMP_CONTENT_LISTTYPE_SECTION) && ($currentSection =& $currentPage->getSection())) {
    if (!AmpUtility::display_okay($currentSection)) {
        AMP_make_404();
    }
    if ($target = $currentSection->getHeaderRedirect()) {
        ampredirect($target);
    }
}
/**
コード例 #25
0
ファイル: List.php プロジェクト: radicaldesigns/amp
 function set_pager_request($vars)
 {
     if (!isset($this->_pager)) {
         $this->_pager_target = AMP_url_update($this->_pager_target, $vars);
         return;
     }
     $this->_pager->set_request($vars);
 }
コード例 #26
0
ファイル: Breadcrumb.inc.php プロジェクト: radicaldesigns/amp
 function _ancestryLinks()
 {
     $links = array();
     if (!isset($this->current_section)) {
         return $links;
     }
     $ancestors = $this->map->getAncestors($this->current_section);
     if (empty($ancestors)) {
         return $links;
     }
     foreach ($ancestors as $id => $section_name) {
         $section_name = $this->_trimText($section_name);
         $sectionURL = AMP_url_update('section.php', array('id' => $id));
         $new_item = "<a href=\"" . $this->baseURL . $sectionURL . "\" class=\"" . $this->css_class . "\">" . $section_name . "</a>";
         array_unshift($links, $new_item);
     }
     return $links;
 }
コード例 #27
0
ファイル: List.php プロジェクト: radicalsuz/amp
 function _renderBlock($output)
 {
     //$sortable_script = 'Sortable.create( "'.$this->list_id.'", { tag: "tr", only: "list_row", scroll: window  });';
     return $this->root_render_block($this->_renderer->form($this->render_toolbar() . $this->_renderer->tag('table', $this->_renderer->tag('tbody', $this->render_column_headers() . $output, array('id' => $this->list_id, 'class' => 'system'))) . $this->render_toolbar(), array('name' => $this->list_id, 'action' => AMP_url_update($_SERVER['REQUEST_URI']), 'method' => 'POST')));
 }
コード例 #28
0
ファイル: modinput4_edit.php プロジェクト: radicaldesigns/amp
/*
$modidselect = $dbcon->Execute("SELECT id from modules where userdatamodid=" . $dbcon->qstr( $modin ) )
 or die( "Couldn't get module information: " . $dbcon->ErrorMsg() );

$modid = $modidselect->Fields("id");
*/
// Fetch the form instance specified by submitted modin value.
$udm = new UserDataInput($dbcon, $modin, true);
$udm->doPlugin("QuickForm", "BuildAdmin");
$mod_id = $udm->modTemplateID;
// Was data submitted via the web?
$sub = isset($_REQUEST['btnUdmSubmit']) && $_REQUEST['btnUdmSubmit'];
// Fetch or save user data.
if ($sub) {
    $udm->doPlugin('AMPsystem', 'Save');
    ampredirect(AMP_url_update($_SERVER['PHP_SELF'], array('modin' => $modin)));
}
/* Now Output the Form.

   Any necessary changes to the form should have been registered
   before now, including any error messages, notices, or
   complete form overhauls. This can happen either within the
   $udm object, or from print() or echo() statements.

   By default, the form will include AMP's base template code,
   and any database-backed intro text to the appropriate module.

*/
include "header.php";
print "<h2>Add/Edit " . $udm->name . " Form</h2>";
print $udm->output();
コード例 #29
0
ファイル: SearchForm.inc.php プロジェクト: radicaldesigns/amp
 /**
  * returns html for the search form
  */
 function execute($options = array())
 {
     $options = array_merge($this->getOptions(), $options);
     if (isset($options['search_form_display']) && !$options['search_form_display'] && !$this->udm->admin) {
         return false;
     }
     $frmName = $options['form_name'];
     $frmMethod = 'GET';
     $frmAction = $_SERVER['PHP_SELF'];
     $form = new HTML_QuickForm($frmName, $frmMethod, $frmAction);
     //remove the zip field if distance search is disabled
     //this is no longer relevant since all the fields can be specified directly
     //if (!$options['show_distance']) unset ($this->fields_def['zip']);
     if (isset($this->fields_def['field_order'])) {
         $fieldOrder = preg_split("/\\s?,\\s?/", $this->fields_def['field_order']);
         foreach ($fieldOrder as $field) {
             $field = trim($field);
             if (isset($this->fields_def[$field]) && (isset($options['show_' . $field]) ? $options['show_' . $field] : true)) {
                 $this->form_addElement($form, $field, $this->fields_def[$field], $this->udm->admin);
             }
         }
     } else {
         foreach ($this->fields_def as $fname => $fdef) {
             if (isset($options['show_' . $field]) ? $options['show_' . $field] : true) {
                 $this->form_addElement($form, $fname, $fdef, $this->udm->admin);
             }
         }
     }
     $this->form =& $form;
     $output = $form->toHtml();
     if ($options['show_search_header']) {
         $output = $this->search_text_header() . $output;
     }
     if ($this->udm->admin) {
         $renderer = AMP_get_renderer();
         $live_url = AMP_SITE_URL . AMP_url_update(AMP_CONTENT_URL_FORM, array('modin' => $this->udm->instance));
         $output .= $renderer->div(AMP_TEXT_LIVE_LINK . ': ' . $renderer->link($live_url, $live_url, array('target' => 'blank')), array('class' => 'preview_link')) . $renderer->newline();
     }
     return $output;
 }
コード例 #30
0
ファイル: Item.inc.php プロジェクト: radicaldesigns/amp
 function get_constant_url($url_type, $interface_type)
 {
     $url_constant = strtoupper($interface_type . $url_type);
     if (!defined($url_constant)) {
         return false;
     }
     if (!(isset($this->id) && $this->id)) {
         return constant($url_constant);
     }
     return AMP_url_update(constant($url_constant), array($this->id_field => $this->id));
 }