Пример #1
0
 function setBase($page = "index.php")
 {
     $reg =& AMP_Registry::instance();
     $this->baseURL = "/";
     $this->toplink = $this->baseURL . $page;
     $this->current_section = $this->top;
 }
Пример #2
0
 function getPaymentFields()
 {
     $payment_field_set = $this->payment_fields;
     $reg =& AMP_Registry::instance();
     $payment_set = new PaymentItemSet($reg->getDbcon());
     $payment_set->readData();
     $payment_field_set['payment_items_id']['values'] = $payment_set->optionValues();
     return $payment_field_set;
 }
Пример #3
0
 function &getDbcon()
 {
     static $dbcon = false;
     if (!$dbcon) {
         $registry =& AMP_Registry::instance();
         $dbcon = $registry->getEntry(AMP_REGISTRY_DBCON);
     }
     return $dbcon;
 }
Пример #4
0
 function _initThumbAttrs()
 {
     $reg =& AMP_Registry::instance();
     if ($thumb_attr = $reg->getEntry(AMP_REGISTRY_CONTENT_IMAGE_THUMB_ATTRIBUTES)) {
         $this->_thumb_attr = array_merge($this->_thumb_attr, $thumb_attr);
     } else {
         $this->_thumb_attr['width'] = AMP_IMAGE_WIDTH_THUMB;
     }
 }
Пример #5
0
 function _init_fields()
 {
     if (!empty($this->_fields)) {
         return $this->_fields;
     }
     $modin = $this->getModin();
     if (!$modin) {
         return false;
     }
     $sourceDef = get_class($this) . $modin;
     //check registry for field defs
     $reg =& AMP_Registry::instance();
     $definedSources =& $reg->getEntry(AMP_REGISTRY_SYSTEM_DATASOURCE_DEFS);
     if (!$definedSources) {
         $definedSources = AMP_cache_get(AMP_REGISTRY_SYSTEM_DATASOURCE_DEFS);
     }
     if ($definedSources && isset($definedSources[$sourceDef])) {
         return $definedSources[$sourceDef];
     }
     require_once 'AMP/System/UserData.php';
     $moduleSource =& new AMPSystem_UserData($this->dbcon, $modin);
     if (!$moduleSource->hasData()) {
         return false;
     }
     $md = $moduleSource->getData();
     $fields = $this->_allowed_keys;
     $keys = array('label', 'public', 'type', 'required', 'values', 'lookup', 'size', 'enabled');
     foreach ($fields as $fname) {
         if (!$fname) {
             continue;
         }
         if (!(isset($md['enabled_' . $fname]) && $md['enabled_' . $fname])) {
             continue;
         }
         $field = array();
         foreach ($keys as $key) {
             $field[$key] = $md[$key . "_" . $fname];
         }
         $field = $this->_register_lookups($field);
         $this->_fields[$fname] = $field;
     }
     //Publish Field Hack
     if ($md['publish']) {
         $publish_field = array('type' => 'checkbox', 'label' => '<span class=publish_label>PUBLISH</span>', 'required' => false, 'public' => false, 'values' => 0, 'size' => null, 'enabled' => true);
         $this->_fields['publish'] = $publish_field;
     }
     //cache field defs to registry
     $definedSources[$sourceDef] = $this->_fields;
     $reg->setEntry(AMP_REGISTRY_SYSTEM_DATASOURCE_DEFS, $definedSources);
     AMP_cache_set(AMP_REGISTRY_SYSTEM_DATASOURCE_DEFS, $definedSources);
     return $this->_fields;
 }
Пример #6
0
 function recalculate(&$target_set, $args = null)
 {
     $new_sizes = array();
     if (isset($args['image_width_thumb']) && is_numeric($args['image_width_thumb']) && $args['image_width_thumb'] && $args['image_width_thumb'] != AMP_IMAGE_WIDTH_THUMB) {
         $new_sizes['thumb'] = $args['image_width_thumb'];
         $reg =& AMP_Registry::instance();
         $reg_value = array('width' => $new_sizes['thumb']);
         $reg->setEntry(AMP_REGISTRY_CONTENT_IMAGE_THUMB_ATTRIBUTES, $reg_value);
     }
     if (isset($args['image_width_tall']) && is_numeric($args['image_width_tall']) && $args['image_width_tall'] && $args['image_width_tall'] != AMP_IMAGE_WIDTH_TALL) {
         $new_sizes['tall'] = $args['image_width_tall'];
     }
     if (isset($args['image_width_wide']) && is_numeric($args['image_width_wide']) && $args['image_width_wide'] && $args['image_width_wide'] != AMP_IMAGE_WIDTH_WIDE) {
         $new_sizes['wide'] = $args['image_width_wide'];
     }
     if (empty($new_sizes)) {
         return false;
     }
     $this->_saveNewWidthSettings($new_sizes);
     foreach ($target_set as $target) {
         $this->resize($target, $new_sizes);
     }
     $this->_clear_cache($target);
 }
Пример #7
0
<?php

require_once 'AMP/System/Base.php';
require_once 'AMP/System/Page/Menu.inc.php';
require_once 'AMP/System/Page/Display.php';
$id = isset($_GET['id']) && $_GET['id'] ? $_GET['id'] : 'home';
$menu = new AMP_System_Page_Menu($id);
$display = new AMP_System_Page_Display(AMP_Registry::instance());
$display->add($menu);
print $display->execute();
Пример #8
0
 function _init_thumbnail_attributes()
 {
     if (AMP_IMAGE_CLASS_THUMB == $this->_list_image_class) {
         $reg =& AMP_Registry::instance();
         if ($thumb_attr = $reg->getEntry(AMP_REGISTRY_CONTENT_IMAGE_THUMB_ATTRIBUTES)) {
             $this->_thumb_attr = array_merge($this->_thumb_attr, $thumb_attr);
         }
     }
 }
Пример #9
0
<?php

require_once 'AMP/BaseDB.php';
$GLOBALS['admin_auth'] =& AMP_Registry::instance();
$db_type = 'mysql';
$db_host = AMP_DB_HOST;
$db_name = AMP_DB_NAME;
$db_username = AMP_DB_USER;
$db_password = AMP_DB_PASS;
$db_prefix = 'punbb_';
$p_connect = false;
$cookie_name = 'punbb_cookie';
$cookie_domain = '';
$cookie_path = '/';
$cookie_secure = 0;
$cookie_seed = '744c5f12';
if (defined('AMP_LOCAL_PATH')) {
    if (!defined('PUN_CACHE_DIR')) {
        define('PUN_CACHE_DIR', AMP_LOCAL_PATH . '/cache/punbb');
    }
    if (!defined('PUN_STYLE_PATH')) {
        define('PUN_STYLE_PATH', '/custom/punbb/styles/');
    }
    if (!defined('PUN_STYLE_DIR')) {
        define('PUN_STYLE_DIR', AMP_LOCAL_PATH . PUN_STYLE_PATH);
    }
} else {
    if (!defined('PUN_CACHE_DIR')) {
        define('PUN_CACHE_DIR', PUN_ROOT . 'cache/');
    }
}
Пример #10
0
 function _HTML_media_thumbnail($url)
 {
     if (!$url) {
         return false;
     }
     $reg =& AMP_Registry::instance();
     if ($thumb_attr = $reg->getEntry(AMP_REGISTRY_CONTENT_IMAGE_THUMB_ATTRIBUTES)) {
         $this->_thumb_attr = array_merge($this->_thumb_attr, $thumb_attr);
     }
     return $this->_HTML_image($url, $this->_thumb_attr);
 }
Пример #11
0
<?php

require_once 'AMP/Content/Page.inc.php';
require_once 'AMP/Content/Map/Breadcrumb.inc.php';
$breadcrumb =& AMP_Breadcrumb_Content::instance();
$urlvars = AMP_URL_Read();
$reg =& AMP_Registry::instance();
$intro_id = $reg->getEntry(AMP_REGISTRY_CONTENT_INTRO_ID);
if (isset($urlvars['list']) && $urlvars['list'] == AMP_CONTENT_LISTTYPE_CLASS) {
    $breadcrumb->findClass($urlvars[AMP_CONTENT_LISTTYPE_CLASS]);
}
if (isset($urlvars['id']) && $urlvars['id'] && !isset($urlvars['list']) && strpos($_SERVER['PHP_SELF'], 'article.php') !== FALSE) {
    $breadcrumb->findArticle($urlvars['id']);
}
if (isset($urlvars['list']) && $urlvars['list'] == AMP_CONTENT_LISTTYPE_SECTION) {
    $breadcrumb->findSection($urlvars[AMP_CONTENT_LISTTYPE_SECTION]);
}
if (strpos($_SERVER['PHP_SELF'], 'article.php') === FALSE && isset($intro_id) && $intro_id !== 1) {
    $breadcrumb->findIntroText($intro_id);
}
$currentPage =& AMPContent_Page::instance();
if (isset($currentPage) && ($page_section = $currentPage->getSectionId())) {
    $breadcrumb->findSection($page_section);
}
if (isset($urlvars['template_section']) && $urlvars['template_section']) {
    $breadcrumb->findSection($urlvars['template_section']);
}
//this guard clause is a temporary measure until breadcrumb is reliably called
//by the template
if (!isset($avoid_printing_breadcrumb)) {
    print $breadcrumb->execute();
Пример #12
0
        die("Incomplete database configuration. Please contact your system administrator.");
    }
} else {
    die("Couldn't find a local site configuration file. Please contact your system administrator.");
}
if (!isset($ADODB_CACHE_DIR) || !is_dir($ADODB_CACHE_DIR) || !is_writable($ADODB_CACHE_DIR)) {
    $ADODB_CACHE_DIR = AMP_urlFlip(AMP_LOCAL_PATH . '/cache');
}
if (!defined('AMP_BASE_PATH')) {
    define('AMP_BASE_PATH', $_SERVER['DOCUMENT_ROOT']);
}
if (!defined('AMP_BASE_INCLUDE_PATH')) {
    define('AMP_BASE_INCLUDE_PATH', $_SERVER['DOCUMENT_ROOT'] . '/include/');
}
// turn on APD debugger when set by config file
if (defined('AMP_DEBUG_MODE_APD') && AMP_DEBUG_MODE_APD && function_exists('apd_set_pprof_trace')) {
    apd_set_pprof_trace();
}
// Connect to the database.
if (!defined('AMP_DB_TYPE')) {
    define('AMP_DB_TYPE', 'mysql');
}
ADOLoadCode(AMP_DB_TYPE);
$dbcon = ADONewConnection(AMP_DB_TYPE);
if (!$dbcon->Connect(AMP_DB_HOST, AMP_DB_USER, AMP_DB_PASS, AMP_DB_NAME)) {
    die('Connection to database ' . AMP_DB_NAME . ' was refused.  Please check your site configuration file.');
}
require_once 'AMP/Registry.php';
//add the dbcon to the Registry
$registry = AMP_Registry::instance();
$registry->setDbcon($dbcon);
Пример #13
0
 function setUP()
 {
     $registry = AMP_Registry::instance();
     $dbcon = $registry->getDbcon();
     $this->udm = new UserData($dbcon, 1);
 }
Пример #14
0
function AMP_load_site_command_line()
{
    $local_path_pattern = '/home/%s/public_html/';
    #$local_path_pattern = '/home/%s/';
    $site_folder = $_SERVER['argv'][1];
    if (!$site_folder) {
        trigger_error('Usage: login_link.php sitename');
        return false;
    }
    define('AMP_LOCAL_PATH', sprintf($local_path_pattern, $site_folder));
    #define( 'AMP_SYSTEM_CACHE', false );
    $config_file_path = sprintf($local_path_pattern, $site_folder) . 'custom/';
    $lib_file_path = sprintf($local_path_pattern, $site_folder) . 'lib/';
    $include_path = sprintf($local_path_pattern, 'amp') . 'include/';
    $include_path = '/home/amp/public_html/include/';
    define('AMP_BASE_INCLUDE_PATH', $include_path);
    $config_file1 = 'SiteConfig.php';
    $config_file2 = 'config.php';
    $incpath = ini_get('include_path');
    // Search local paths for includes.
    ini_set('include_path', $include_path . ':' . $config_file_path . ':' . $lib_file_path . ':' . ini_get('include_path'));
    if (!file_exists($config_file_path . $config_file1) && !file_exists($config_file_path . $config_file2)) {
        trigger_error('path not found: ' . $config_file_path . $config_file2);
        return false;
    }
    require_once 'utility.system.functions.inc.php';
    require_once 'utility.functions.inc.php';
    require_once 'AMP/System/Flash.php';
    if (file_exists($config_file_path . $config_file1)) {
        require_once $config_file_path . $config_file1;
    } else {
        require_once $config_file_path . $config_file2;
        if (isset($MM_DBTYPE)) {
            define('AMP_DB_TYPE', $MM_DBTYPE);
        }
        define('AMP_DB_HOST', $MM_HOSTNAME);
        define('AMP_DB_USER', $MM_USERNAME);
        define('AMP_DB_PASS', $MM_PASSWORD);
        define('AMP_DB_NAME', $MM_DATABASE);
    }
    require_once 'adodb/adodb.inc.php';
    if (!defined('AMP_DB_TYPE')) {
        define('AMP_DB_TYPE', 'mysql');
    }
    ADOLoadCode(AMP_DB_TYPE);
    $dbcon = ADONewConnection(AMP_DB_TYPE);
    if (!$dbcon->Connect(AMP_DB_HOST, AMP_DB_USER, AMP_DB_PASS, AMP_DB_NAME)) {
        trigger_error('database connection failed');
        return false;
    }
    require_once 'AMP/Registry.php';
    $registry = AMP_Registry::instance();
    $registry->setDbcon($dbcon);
    //define( 'AMP_SYSTEM_CACHE', false );
    define('AMP_SITE_CACHE_TIMEOUT', 0);
    require_once 'AMP/System/Config.inc.php';
    require_once 'AMP/System/Language/Config.php';
    require_once 'AMP/Base/Debug.php';
    //require_once( 'AMP/System/Cache/Config.inc.php');
    AMP_config_load('cache');
    require_once 'AMP/Base/Setup.php';
    //require_once( 'AMP/System/User/Config.php');
    AMP_config_load('tools');
    require_once 'AMP/Base/Lookups.php';
    AMP_config_load('site');
    AMP_config_load('content');
    require_once 'AMP/Content/Map.inc.php';
    return $site_folder;
}
Пример #15
0
 function _set_public_page(&$public_page)
 {
     if (!$public_page) {
         return;
     }
     $this->_public_page_id = $public_page->id;
     $this->_display->add($public_page->getDisplay(), AMP_CONTENT_DISPLAY_KEY_INTRO);
     $reg =& AMP_Registry::instance();
     $reg->setEntry(AMP_REGISTRY_CONTENT_INTRO_ID, $this->_public_page_id);
     if (!isset($this->_page)) {
         require_once 'AMP/Content/Page.inc.php';
         $this->_page = AMPContent_Page::instance();
     }
     $this->_page->setIntroText($this->_public_page_id);
     $this->_page->initLocation();
 }
Пример #16
0
 function commit_update()
 {
     //set phpgacl options
     $gacl_options = array('smarty_dir' => 'phpgacl/admin/smarty/libs', 'smarty_template_dir' => 'phpgacl/admin/templates', 'smarty_compile_dir' => AMP_SYSTEM_CACHE_PATH, 'db_type' => AMP_DB_TYPE, 'db_host' => AMP_DB_HOST, 'db_user' => AMP_DB_USER, 'db_password' => AMP_DB_PASS, 'db_name' => AMP_DB_NAME, 'db_table_prefix' => 'acl_');
     if (!defined('AMP_SYSTEM_PERMISSIONS_LOADING')) {
         define('AMP_SYSTEM_PERMISSIONS_LOADING', 1);
     }
     require_once 'phpgacl/gacl_api.class.php';
     $gacl =& new gacl_api($gacl_options);
     //$gacl = AMP_acl( true );
     $this->_upgrade_database('acl_');
     $gacl->clear_database();
     //ACOs
     $aco_objects = array('view' => 'View', 'access' => 'Access', 'create' => 'Create', 'save' => 'Save', 'submit' => 'Submit', 'publish' => 'Publish', 'delete' => 'Delete');
     $aco_sections = array('commands' => 'Commands');
     $aco_complete_set = array('commands' => $aco_objects);
     foreach ($aco_sections as $value => $name) {
         $aco_section_id[$value] = $gacl->add_object_section($name, $value, 0, 0, 'ACO');
         foreach ($aco_objects as $aco_value => $aco_name) {
             $aco_id[$aco_value] = $gacl->add_object($value, $aco_name, $aco_value, 0, 0, 'ACO');
         }
     }
     // AROs
     $client_root_id = $gacl->add_group('clients', 'Clients', 0, 'ARO');
     $admin_group = $gacl->add_group('admins', 'Admins', $client_root_id, 'ARO');
     $users = AMP_lookup('admins');
     $aro_sections = array('users' => 'Users');
     foreach ($users as $id => $name) {
         $aro_objects['user_' . $id] = $name;
     }
     foreach ($aro_sections as $value => $name) {
         $gacl->add_object_section($name, $value, 0, 0, 'ARO');
     }
     foreach ($aro_objects as $value => $name) {
         $aro_object_ids[$value] = $gacl->add_object('users', $name, $value, 0, 0, 'ARO');
         $gacl->add_group_object($admin_group, 'users', $value, 'ARO');
     }
     //AXOs
     $system_root = $gacl->add_group('system', 'AMP', 0, 'AXO');
     $site_root = $gacl->add_group('site', AMP_SITE_NAME, $system_root, 'AXO');
     $section_root = $gacl->add_object_section(AMP_SITE_NAME . ' Content', 'sections', 0, 0, 'AXO');
     $section_order_ref = AMP_lookup('sectionMap');
     require_once 'AMP/Content/Map/Complete.php';
     $map = AMP_Content_Map_Complete::instance();
     $map_result = $map->selectOptions();
     $section_order_ref = $map_result;
     $section_names_source = new AMPContentLookup_Sections();
     //AMP_lookup( 'sections' );
     $section_parents_source = new AMPContentLookup_SectionParents();
     AMP_lookup('sectionParents');
     $section_names = $section_names_source->dataset;
     $section_parents = $section_parents_source->dataset;
     if ($section_order_ref && $section_names) {
         $sections = array_combine_key(array_keys($section_order_ref), $section_names);
         $sections = array(AMP_CONTENT_MAP_ROOT_SECTION => AMP_SITE_NAME) + $sections;
     } else {
         $sections = array(AMP_CONTENT_MAP_ROOT_SECTION => AMP_SITE_NAME);
     }
     $axo_group_ids = array();
     foreach ($sections as $id => $name) {
         $parent_group_id = $site_root;
         $parent_id_content = isset($section_parents[$id]) ? $section_parents[$id] : AMP_CONTENT_MAP_ROOT_SECTION;
         if (isset($axo_group_ids[$parent_id_content])) {
             $parent_group_id = $axo_group_ids[$parent_id_content];
         }
         $parent_group_id = $gacl->add_group('section_' . $id, $name, $parent_group_id, 'AXO');
         $axo_group_ids['section'][$id] = $parent_group_id;
         $axo_object_ids[$id] = $gacl->add_object('sections', $name, 'section_' . $id, 0, 0, 'AXO');
         $gacl->add_group_object($parent_group_id, 'sections', 'section_' . $id, 'AXO');
     }
     //ACLs
     $group_ids = AMP_lookup('permissionGroups');
     foreach ($group_ids as $group_id => $group_name) {
         $acl_group_id = $gacl->add_group('group_' . $group_id, $group_name, $admin_group, 'ARO');
         $allowed_sections_lookup =& new AMPSystemLookup_SectionsByGroup($group_id);
         //AMP_lookup( 'sectionsByGroup', $group_id );
         $allowed_sections = $allowed_sections_lookup->dataset;
         $affected_users = AMP_lookup('usersByGroup', $group_id);
         if (!$affected_users) {
             continue;
         }
         foreach ($affected_users as $user_id => $user_name) {
             $gacl->add_group_object($acl_group_id, 'users', 'user_' . $user_id, 'ARO');
         }
         if (!$allowed_sections) {
             $allow_group = array($site_root);
         } else {
             $allow_group = array_combine_key(array_keys($allowed_sections), $axo_group_ids['section']);
         }
         $acl_id = $gacl->add_acl($aco_complete_set, array(), array($acl_group_id), array(), $allow_group, true, true);
     }
     $reg =& AMP_Registry::instance();
     $reg->setEntry(AMP_REGISTRY_PERMISSION_MANAGER, $gacl);
     $this->message('Permissions Update Successful');
     AMP_cacheFlush(AMP_CACHE_TOKEN_LOOKUP);
     return true;
 }
Пример #17
0
 function _set_public_page(&$public_page)
 {
     if (!$public_page) {
         return;
     }
     $this->_public_page_id = $public_page->id;
     $this->_display->add($public_page->getDisplay());
     $reg =& AMP_Registry::instance();
     $reg->setEntry(AMP_REGISTRY_CONTENT_INTRO_ID, $this->_public_page_id);
     $this->_page->setIntroText($this->_public_page_id);
     $this->_page->initLocation();
 }
Пример #18
0
 /**
  * Private Class Constructor Helper 
  * 
  * @param   object  $dbcon    An active database connection 
  * @since 3.5.3
  * @access protected
  * @return void
  * @ignore
  */
 function __construct(&$dbcon)
 {
     $this->dbcon =& $dbcon;
     $this->_registry =& AMP_Registry::instance();
     $this->map =& AMPContent_Map::instance();
     $this->contentManager =& AMPContent_Manager::instance();
 }
Пример #19
0
function AMP_get_column_names($table_name)
{
    //caches calls to dbcon::metacolumns, which are expensive
    $reg =& AMP_Registry::instance();
    $definedSources =& $reg->getEntry(AMP_REGISTRY_SYSTEM_DATASOURCE_DEFS);
    if (!$definedSources) {
        $definedSources = AMP_cache_get(AMP_REGISTRY_SYSTEM_DATASOURCE_DEFS);
        if ($definedSources) {
            $reg->setEntry(AMP_REGISTRY_SYSTEM_DATASOURCE_DEFS, $definedSources);
        }
    }
    if ($definedSources && isset($definedSources[$table_name])) {
        return $definedSources[$table_name];
    }
    $dbcon = AMP_Registry::getDbcon();
    $colNames = $dbcon->MetaColumnNames($table_name);
    $definedSources[$table_name] = $colNames;
    $reg->setEntry(AMP_REGISTRY_SYSTEM_DATASOURCE_DEFS, $definedSources);
    AMP_cache_set(AMP_REGISTRY_SYSTEM_DATASOURCE_DEFS, $definedSources);
    return $colNames;
}