예제 #1
0
파일: class.Login.php 프로젝트: hshoghi/cms
 public function checkLoginPath()
 {
     $n = $_SERVER['SERVER_NAME'];
     $this->login_path = reset(explode('?', $this->login_path));
     if (stripos($this->login_path, $n) === false) {
         return;
     }
     if ('http://' . $n . $_SERVER['REQUEST_URI'] == $this->login_path) {
         return;
     }
     $name = str_replace(array($n, 'http://'), '', $this->login_path);
     $dirs = array_filter(explode('/', $name));
     global $access_groups;
     $path = null;
     foreach ($dirs as $dir) {
         if (!$path) {
             $path = 'pages/' . $dir . '/';
         } else {
             $path .= $dir . '/';
         }
         $settings_file = $path . $dir . '-settings.php';
         if (file_exists_incpath($settings_file)) {
             include $settings_file;
         }
     }
 }
예제 #2
0
파일: Form.php 프로젝트: radicaldesigns/amp
 function parse_file_comments($file_name)
 {
     $custom_file_name = AMP_LOCAL_PATH . '/custom/' . $file_name . '.ini.php';
     if (!file_exists($custom_file_name)) {
         $custom_file_name = 'Config/' . $file_name . '.ini.php';
         if (!file_exists_incpath($custom_file_name)) {
             return array();
         }
     }
     $fileRef = fopen($custom_file_name, 'r');
     $result = array();
     $current_header = '';
     while ($line = fgets($fileRef)) {
         if (strlen($line) < 2) {
             continue;
         }
         if (substr($line, 0, 1) == ';') {
             $current_header .= substr($line, 1);
             continue;
         }
         if (!$current_header) {
             continue;
         }
         $line_name = str_replace(array('[', ']'), '', reset(split('=', $line)));
         $result[$line_name] = $current_header;
         $current_header = '';
     }
     return $result;
 }
예제 #3
0
 function _load_template_file($request_path)
 {
     $path_verified = false;
     $path_exists = file_exists_incpath($request_path);
     if ($path_exists) {
         $path_verified = $path_exists;
     } else {
         $test_path = $this->_path_default . basename($request_path);
         if ($path_exists = file_exists_incpath($test_path)) {
             $path_verified = $path_exists;
         }
     }
     if (file_exists($path_verified)) {
         return file_get_contents($path_verified);
     }
     /*
     $paths = explode(PATH_SEPARATOR, get_include_path());
     foreach ($paths as $path)
     {
         // Formulate the absolute path
         $fullpath = $path . DIRECTORY_SEPARATOR . $path_verified;
     
         // Check it
         if (file_exists($fullpath)) {
             return file_get_contents( $fullpath );
         }
     }
     return false;
     */
 }
예제 #4
0
 function getFile()
 {
     $fullpath = $this->locateFile();
     if (!file_exists_incpath($fullpath)) {
         return false;
     }
     return file_get_contents($fullpath, true);
 }
예제 #5
0
 function getFile()
 {
     //$fullpath = AMP_pathFlip( $this->locateFile() );
     $fullpath = $this->locateFile();
     if (!($fullpath && file_exists_incpath($fullpath))) {
         return false;
     }
     return file_get_contents($fullpath, true);
 }
예제 #6
0
 /**
  *  loads aql model classes
  *  models/{name}/class.{name}.php
  *  @param string $name
  *  @return boolean
  *  @global $sky_aql_model_path
  */
 public static function globalAqlModelLoader($name)
 {
     global $sky_aql_model_path;
     $path = sprintf('%s/%s/class.%s.php', $sky_aql_model_path, $name, $name);
     if (file_exists_incpath($path)) {
         include $path;
         if (class_exists($className)) {
             return true;
         }
     }
     return false;
 }
예제 #7
0
 function _getFieldOverrides($file_name)
 {
     $override_file_name = str_replace('.xml', '_Override.xml', $file_name);
     $override_file_path = file_exists_incpath($override_file_name);
     if (!$override_file_name) {
         return array();
     }
     $field_overrides = $this->_readXML($override_file_path);
     if (!$field_overrides) {
         return array();
     }
     return $field_overrides;
 }
예제 #8
0
 function evalnavhtml($string)
 {
     global $base_path, $dbcon, $MM_type, $MM_parent, $MM_typename, $list, $id, $MM_issue, $MM_region, $navalign;
     global $rNAV_HTML_1, $rNAV_HTML_2, $rNAV_HTML_3, $rNAV_HTML_4, $rNAV_HTML_5;
     global $lNAV_HTML_1, $lNAV_HTML_2, $lNAV_HTML_3, $lNAV_HTML_4, $lNAV_HTML_5;
     if (!isset($start)) {
         $start = '';
     }
     $pos = strpos($string, '<?php', $start);
     $start = 0;
     /* Loop through to find the php code in html...  */
     while (!($pos === FALSE)) {
         /* Find the end of the php code.. */
         $pos2 = strpos($string, "?>", $pos + 5);
         /* Eval outputs directly to the buffer. Catch / Clean it */
         $code = substr($string, $pos + 5, $pos2 - $pos - 5);
         $variables = preg_replace('/.*\\$([^\\s]*)\\s*=\\s*["\']{0,1}([^"\']*)["\']{0,1}.*/', "\$1 \$2", $code);
         $va_args = split(" ", $variables);
         if ($va_args[0] == 'regionlink') {
             $regionlink = $va_args[1];
         }
         if ($va_args[0] == 'navalign') {
             $navalign = $va_args[1];
         }
         //echo $regionlink.'<br>';
         $include_args = preg_replace("/.*include\\s*[\\(\\s*]?\\s*\"?([^\\)\"\\s]*)\"?[\\)\\s*]?.*/", "\$1", $code);
         $incl = str_replace('"', '', $include_args);
         #echo $incl.'<br>';
         ob_start();
         $customfile = AMP_LOCAL_PATH . DIRECTORY_SEPARATOR . 'custom' . DIRECTORY_SEPARATOR . $incl;
         if (file_exists($customfile)) {
             include $customfile;
         } else {
             $basefile = 'AMP/Nav/' . $incl;
             if (file_exists_incpath($basefile)) {
                 include $basefile;
             } elseif (file_exists_incpath($incl)) {
                 $file = $incl;
                 include $file;
             }
         }
         $value = ob_get_contents();
         ob_end_clean();
         /* Grab that chunk!  */
         $start = $pos + strlen($value);
         $string = substr($string, 0, $pos) . $value . substr($string, $pos2 + 2);
         $pos = strpos($string, '<?php', $start);
     }
     return $string;
 }
예제 #9
0
 function _register_fields_dynamic()
 {
     $options = $this->getOptions();
     if (!(isset($options['override_file']) && $options['override_file'])) {
         return;
     }
     if (!file_exists_incpath($options['override_file'])) {
         trigger_error("can't find override file {$options['override_file']}");
         return;
     }
     $override_fields = $this->_read_xml_fields($options['override_file']);
     if (!$override_fields) {
         trigger_error("XML read failed for override file {$options['override_file']}");
         return;
     }
     $this->udm->fields = array_merge($this->udm->fields, $override_fields);
 }
예제 #10
0
 function _loadItemType($type)
 {
     if (!isset($this->_content_item_types[$type])) {
         return false;
     }
     if (class_exists($this->_content_item_types[$type])) {
         return true;
     }
     $load_filename = 'AMP/Content/' . ucfirst($type) . '.inc.php';
     if (isset($this->_content_item_paths[$type])) {
         $load_filename = $this->_content_item_paths[$type];
     }
     if (!file_exists_incpath($load_filename)) {
         return false;
     }
     include_once $load_filename;
     return $this->_content_item_paths[$type];
 }
예제 #11
0
 function execute()
 {
     if ($badge_id = $this->nav->getBadgeId()) {
         return $this->do_badge($badge_id);
     }
     if (!($filename = $this->nav->getIncludeFile())) {
         return false;
     }
     $fullpath = file_exists_incpath($filename);
     if (!$fullpath) {
         $fullpath = file_exists_incpath('AMP/Nav/' . $filename);
     }
     if (!$fullpath) {
         return false;
     }
     $nav_class = $this->nav->getIncludeClass();
     $nav_function = $this->nav->getIncludeFunction();
     if (!$nav_class && !$nav_function) {
         return $this->_raw_include($fullpath);
     }
     //include the file -- don't make a mess in these guys!
     include_once $fullpath;
     if (!$nav_class && is_callable($nav_function)) {
         return $nav_function($this->get_arguments());
     }
     return $this->_raw_include($fullpath);
     /*
     $nav = false;
     if ( $nav_class && class_exists( $nav_class )) {
         $nav = &new $nav_class( );
     }
     
     if ( $nav ) {
         if ( is_callable( array( $nav, $nav_function ))) {
             return $nav->$nav_function( );
         }
         if ( method_exists( $nav, 'execute' )) {
             return $nav->execute( );
         }
     }
     */
 }
예제 #12
0
 function &makeCopier($classname)
 {
     $filename = 'AMP/System/' . str_replace("_", DIRECTORY_SEPARATOR, $classname) . '/Copy.inc.php';
     if (file_exists_incpath($filename)) {
         include_once $filename;
     }
     $new_class = 'AMPSystem_' . $classname . '_Copy';
     if (class_exists($new_class)) {
         return new $new_class($this->dbcon);
     }
     trigger_error('AMPSystem_Copier: ' . $new_class . ' not found');
     return false;
 }
예제 #13
0
/**
* Returns an array of available DBMS with some data, if a DBMS is specified it will only
* return data for that DBMS and will load its extension if necessary.
*/
function get_available_dbms($dbms = false, $return_unavailable = false)
{
    global $lang;
    $available_dbms = array('firebird' => array('LABEL' => 'FireBird', 'SCHEMA' => 'firebird', 'MODULE' => 'interbase', 'DELIM' => ';;', 'COMMENTS' => 'remove_remarks', 'DRIVER' => 'firebird', 'AVAILABLE' => true), 'mysqli' => array('LABEL' => 'MySQL with MySQLi Extension', 'SCHEMA' => 'mysql', 'MODULE' => 'mysqli', 'DELIM' => ';', 'COMMENTS' => 'remove_remarks', 'DRIVER' => 'mysqli', 'AVAILABLE' => true), 'mysql' => array('LABEL' => 'MySQL', 'SCHEMA' => 'mysql', 'MODULE' => 'mysql', 'DELIM' => ';', 'COMMENTS' => 'remove_remarks', 'DRIVER' => 'mysql', 'AVAILABLE' => true), 'mssql' => array('LABEL' => 'MS SQL Server 2000+', 'SCHEMA' => 'mssql', 'MODULE' => 'mssql', 'DELIM' => 'GO', 'COMMENTS' => 'remove_comments', 'DRIVER' => 'mssql', 'AVAILABLE' => true), 'mssql_odbc' => array('LABEL' => 'MS SQL Server [ ODBC ]', 'SCHEMA' => 'mssql', 'MODULE' => 'odbc', 'DELIM' => 'GO', 'COMMENTS' => 'remove_comments', 'DRIVER' => 'mssql_odbc', 'AVAILABLE' => true), 'oracle' => array('LABEL' => 'Oracle', 'SCHEMA' => 'oracle', 'MODULE' => 'oci8', 'DELIM' => '/', 'COMMENTS' => 'remove_comments', 'DRIVER' => 'oracle', 'AVAILABLE' => true), 'pgsql' => array('LABEL' => 'PostgreSQL 7.x/8.x', 'SCHEMA' => 'postgres', 'MODULE' => 'pgsql', 'DELIM' => ';', 'COMMENTS' => 'remove_comments', 'DRIVER' => 'postgres', 'AVAILABLE' => true), 'sqlite' => array('LABEL' => 'SQLite', 'SCHEMA' => 'sqlite', 'MODULE' => 'sqlite', 'DELIM' => ';', 'COMMENTS' => 'remove_remarks', 'DRIVER' => 'sqlite', 'AVAILABLE' => true));
    if ($dbms) {
        if (isset($available_dbms[$dbms])) {
            $available_dbms = array($dbms => $available_dbms[$dbms]);
        } else {
            return array();
        }
    }
    // now perform some checks whether they are really available
    foreach ($available_dbms as $db_name => $db_ary) {
        $dll = $db_ary['MODULE'];
        if (!@extension_loaded($dll) || !file_exists_incpath("MDB2" . DIRECTORY_SEPARATOR . "Driver" . DIRECTORY_SEPARATOR . $db_name . ".php")) {
            #if (!can_load_dll($dll))
            #{
            if ($return_unavailable) {
                $available_dbms[$db_name]['AVAILABLE'] = false;
            } else {
                unset($available_dbms[$db_name]);
            }
            continue;
            #}
        }
        $any_db_support = true;
    }
    if ($return_unavailable) {
        $available_dbms['ANY_DB_SUPPORT'] = $any_db_support;
    }
    return $available_dbms;
}
예제 #14
0
 function _getIncludeFilename($code)
 {
     $include_args = preg_replace("/.*include\\s*[\\(\\s*]?\\s*\"?([^\\)\"\\s]*)\"?[\\)\\s*]?.*/", "\$1", $code);
     $incl = str_replace('"', '', $include_args);
     $customfile = AMP_LOCAL_PATH . DIRECTORY_SEPARATOR . 'custom' . DIRECTORY_SEPARATOR . $incl;
     if (file_exists($customfile)) {
         return $customfile;
     }
     $basefile = 'AMP/Nav/' . $incl;
     if (file_exists_incpath($basefile)) {
         return $basefile;
     }
     if (file_exists_incpath($incl)) {
         return $incl;
     }
     return false;
 }
예제 #15
0
 /**
  * Includes the template and sets the body of the email with it
  * @param   string  $name   name of template or path to php file
  * @param   array   $data
  * @return  $this
  * @throws  Exception   if using a Mailer template and there is no inc_dir
  * @throws  Excpetion   if the file to include does not exist
  */
 public function inc($name, array $data = array())
 {
     if (strpos($name, '.php')) {
         $include = $name;
     } else {
         if (!self::$inc_dir) {
             throw new Exception('Mailer::$inc_dir not set.');
         }
         $include = self::$inc_dir . $name . '.php';
     }
     if (!file_exists_incpath($include)) {
         throw new Exception('Mailer "' . $include . '" does not exist');
     }
     return $this->setBody($this->_includeTemplate($include, $data));
 }
예제 #16
0
파일: HTML.inc.php 프로젝트: radicalsuz/amp
 function _getIncludeFilename($code)
 {
     $filename = trim($code);
     if (file_exists_incpath($filename)) {
         return $filename;
     }
     return false;
 }
예제 #17
0
 function _setIncludeFileValues()
 {
     $filepaths = $this->component_map->getFilePaths();
     foreach ($filepaths as $type => $filename) {
         if (!file_exists_incpath($filename)) {
             trigger_error('System Page did not find component ' . $type . ' at: ' . $filename);
             continue;
         }
         $this->includes[$type] = $filename;
     }
 }
예제 #18
0
 /**
  * Includes the form file (path/to/models/Model/form.Model.php) in $this scope
  * @return Model
  * @throws Exception       path not found
  */
 public function includeForm()
 {
     $path = $this->getFormPath();
     if (!file_exists_incpath($path)) {
         throw new Exception("Form file [{$path}] does not exist for this model");
     }
     $r = $o = $this;
     include $path;
     return $this;
 }
예제 #19
0
 /**
  * Constructor takes optional parameters to create a new error. If parameters are omitted, an empty (non-error state)
  * error object is created. An error state can subsequently be set using the setError() method
  *
  * @param integer $pn_error_number The numeric error code. Code should be defined in the error definition file
  * @param string $ps_error_description Description of error condition
  * @param string $ps_error_context Context where error occurred. This is typically the Class name and method name where the error occurred. Ex. "Configuration->new()"
  * @param string $ps_error_source Source of error - typically a string identifying the field in a form where the error occurred.
  * @param bool $pb_halt_on_error Whether or not to halt on error state (ie. whether do die()) [default is true]
  * @param bool $pb_report_on_error Whether or not to emit a visible report of error state [default is true]
  * @param string $ps_error_definition_file Path to error definition file; if omitted default file, based upon locale, is used
  */
 public function __construct($pn_error_number = 0, $ps_error_description = '', $ps_error_context = '', $ps_error_source = '', $pb_halt_on_error = true, $pb_report_on_error = true, $ps_error_definition_file = '')
 {
     $this->opo_config = Configuration::load();
     $this->ops_redirect_on_error_page = $this->opo_config->get("error_redirect_to_page");
     # Set locale, if necessary
     if (($vs_locale = $this->opo_config->get("locale")) && (file_exists("Error/errors." . $vs_locale) || file_exists_incpath("Error/errors." . $vs_locale))) {
         $this->ops_locale = $vs_locale;
     }
     # load error messages
     $vs_error_definitions_loaded = 0;
     if ($ps_error_definition_file) {
         $vs_error_definitions_loaded = $this->setErrorDefinitionFile($ps_error_definition_file);
     } else {
         if ($vs_config_error_definition_file = $this->opo_config->get("error_definition_file")) {
             $vs_error_definitions_loaded = $this->setErrorDefinitionFile($vs_config_error_definition_file);
         }
     }
     if (!$vs_error_definitions_loaded) {
         $vs_error_definitions_loaded = $this->setErrorDefinitionFile(__CA_LIB_DIR__ . "/core/Error/errors." . $this->ops_locale);
     }
     if (!$vs_error_definitions_loaded) {
         $vs_error_definitions_loaded = $this->setErrorDefinitionFile(__CA_LIB_DIR__ . "/core/Error/errors.en_us");
     }
     if (!$vs_error_definitions_loaded) {
         die("Error.php: Couldn't load error definitions!\n");
     }
     $this->opb_halt_on_error = $pb_halt_on_error;
     $this->opb_report_on_error = $pb_report_on_error;
     if ($pn_error_number) {
         $this->setError($pn_error_number, $ps_error_description, $ps_error_context);
     }
 }
예제 #20
0
<?php

require_once 'AMP/UserData/Plugin.inc.php';
require_once 'AMP/Region.inc.php';
if (file_exists_incpath('custom.layouts.inc.php')) {
    include_once 'custom.layouts.inc.php';
}
class UserDataPlugin_DisplayHTML_Output extends UserDataPlugin
{
    var $options = array('subheader' => array('available' => true, 'label' => 'Show subheadings for', 'default' => '', 'type' => 'text'), 'subheader2' => array('available' => true, 'label' => 'Show second-level subheadings for', 'default' => '', 'type' => 'text'), 'subheader3' => array('available' => true, 'label' => 'Show third-level subheadings for', 'default' => '', 'type' => 'text'), 'display_format' => array('label' => 'List Display Function Name', 'default' => 'list_display_default', 'available' => true, 'type' => 'text'), 'detail_format' => array('label' => 'Detail Display Function Name', 'default' => 'detail_display_default', 'available' => true, 'type' => 'text'), 'header_text_list' => array('label' => 'Intro Text For List Page', 'default' => '1', 'available' => true, 'type' => 'select'), 'header_text_detail' => array('label' => 'Intro Text For Detail Page', 'default' => '1', 'available' => true, 'type' => 'select'), 'column_count' => array('label' => 'Columns for display', 'default' => '1', 'available' => true, 'type' => 'text', 'size' => '3'), 'column_renderer' => array('label' => 'Column Wrapper Function Name', 'default' => '', 'available' => true, 'type' => 'text'), '_userid' => array('default' => null, 'available' => false));
    var $available = true;
    //multiple subheaders - yay!
    var $current_subheader;
    var $current_subheader2;
    var $current_subheader3;
    var $regionset;
    var $alias = array('Name' => array('f_alias' => 'Name', 'f_orderby' => 'Last_Name,First_Name', 'f_type' => 'text', 'f_sqlname' => "Concat(if(!isnull(First_Name), First_Name, ''), ' ', if(!isnull(Last_Name), Last_Name, '') )"), 'Location' => array('f_alias' => 'Location', 'f_sqlname' => "Concat( if(!isnull(Country), Concat(Country, ' - '),''), if(!isnull(State), Concat(State, ' - '),''), if(!isnull(City), City,''))", 'f_orderby' => '(if(Country="USA",1,if(Country="CAN",2,if(isnull(Country),3,Country)))),State,City,Company', 'f_type' => 'text'), 'Status' => array('f_alias' => 'Status', 'f_orderby' => 'publish', 'f_type' => 'text', 'f_sqlname' => 'if(publish=1,"Live","Draft")'));
    var $_css_class_container_list_column = 'list_column';
    var $_css_class_container_list = 'list_form';
    var $_css_class_container_list_item = 'list_item';
    var $is_last_column = false;
    function UserDataPlugin_DisplayHTML_Output(&$udm, $instance = null)
    {
        $this->init($udm, $instance);
        $this->regionset = new Region();
    }
    function _register_options_dynamic()
    {
        if ($this->udm->admin) {
            /*
            $udm_mod_id  = $this->dbcon->qstr( $this->udm->instance );
예제 #21
0
 function _load_filter($filter_name, $filter_var)
 {
     $filter_class = 'ContentFilter_' . ucfirst($filter_name);
     if (!class_exists($filter_class)) {
         $filter_filename = ucfirst($filter_name) . '.inc.php';
         $filter_path = 'AMP/Content/Article/Filter/' . $filter_filename;
         if (!file_exists_incpath($filter_path)) {
             if (!($filter_path = file_exists_incpath($filter_filename))) {
                 return false;
             }
         }
         include_once $filter_path;
         if (!class_exists($filter_class)) {
             return false;
         }
     }
     $filter = new $filter_class($filter_var);
     $filter->assign();
     return $filter;
 }
예제 #22
0
<?php

if (file_exists_incpath('custom.sources.inc.php')) {
    include_once 'custom.sources.inc.php';
}
$class_names =& AMPContent_Lookup::instance('class');
if (!defined('AMP_TEXT_SECTIONLIST_ARTICLES_FEATURES') && defined('AMP_CONTENT_CLASS_FEATURE')) {
    define('AMP_TEXT_SECTIONLIST_ARTICLES_FEATURES', sprintf(AMP_TEXT_SECTIONLIST_ARTICLES_FEATURES_TEMPLATE, $class_names[AMP_CONTENT_CLASS_FEATURE]));
}
if (!defined('AMP_TEXT_SECTIONLIST_ARTICLES_PLUS_CLASS') && defined('AMP_CONTENT_SECTION_PLUS_CLASS')) {
    define('AMP_TEXT_SECTIONLIST_ARTICLES_PLUS_CLASS', sprintf(AMP_TEXT_SECTIONLIST_ARTICLES_PLUS_CLASS_TEMPLATE, $class_names[AMP_CONTENT_SECTION_PLUS_CLASS]));
}
예제 #23
0
 function render_php_include()
 {
     if (!($include_filename = $this->getInclude())) {
         return false;
     }
     if (!file_exists_incpath($include_filename)) {
         trigger_error(sprintf(AMP_TEXT_ERROR_FILE_EXISTS_NOT, $include_filename));
         return false;
     }
     if ($include_function = $this->getIncludeFunction()) {
         include_once $include_filename;
         if (is_callable($include_function)) {
             $arguments = $this->getIncludeFunctionArguments();
             return $include_function($arguments);
         } else {
             trigger_error(sprintf(AMP_TEXT_ERROR_NOT_DEFINED, $include_filename, $include_function));
             return false;
         }
     }
     //default, just include the file
     ob_start();
     include $include_filename;
     $include_value = ob_get_contents();
     ob_end_clean();
     return $include_value;
 }
예제 #24
0
파일: Form.php 프로젝트: radicaldesigns/amp
 function read_xml_fields($xml_filename)
 {
     if (!file_exists_incpath($xml_filename)) {
         trigger_error(sprintf(AMP_TEXT_ERROR_FILE_EXISTS_NOT, $xml_filename));
         return false;
     }
     $xml = file_get_contents($xml_filename, 1);
     $override_xml_file = str_replace('.xml', '_Override.xml', $xml_filename);
     if (file_exists_incpath($override_xml_file)) {
         $this->add_xml_fields($xml);
         return $this->add_xml_fields(file_get_contents($override_xml_file, 1));
     }
     return $this->add_xml_fields($xml);
 }
예제 #25
0
 function addFilter($filter_name, $filter_var = null)
 {
     $filter_class = 'ContentFilter_' . ucfirst($filter_name);
     if (class_exists($filter_class)) {
         $sourceFilter = new $filter_class($filter_var);
         return $sourceFilter->execute($this);
     }
     $filter_filename = ucfirst($filter_name) . '.inc.php';
     $filter_path = 'AMP/Content/Article/Filter/' . $filter_filename;
     if (!file_exists_incpath($filter_path)) {
         if (!($filter_path = file_exists_incpath($filter_filename))) {
             return false;
         }
     }
     include_once $filter_path;
     $sourceFilter = new $filter_class($filter_var);
     return $sourceFilter->execute($this);
 }
예제 #26
0
파일: DB.php 프로젝트: radicaldesigns/amp
require_once 'utility.system.functions.inc.php';
AMP_init_local_path();
require_once 'utility.functions.inc.php';
if (!isset($ADODB_CACHE_DIR) || !is_dir($ADODB_CACHE_DIR) || !is_writable($ADODB_CACHE_DIR)) {
    $ADODB_CACHE_DIR = AMP_urlFlip(AMP_LOCAL_PATH . '/cache');
}
require_once 'adodb/adodb.inc.php';
// Look for a local site configuration.
if (file_exists_incpath('SiteConfig.php')) {
    // This form is preferred.
    require 'SiteConfig.php';
    if (!defined('AMP_DB_HOST') || !defined('AMP_DB_USER') || !defined('AMP_DB_PASS') || !defined('AMP_DB_NAME')) {
        die("Incomplete site configuration. Please contact your system administrator.");
    }
} elseif (file_exists_incpath('config.php')) {
    if (!defined('AMP_BASE_PATH')) {
        define('AMP_BASE_PATH', $_SERVER['DOCUMENT_ROOT']);
    }
    // Included for backwards-compatibility.
    require_once 'config.php';
    if (isset($MM_HOSTNAME) && isset($MM_USERNAME) && isset($MM_PASSWORD) && isset($MM_DATABASE)) {
        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);
    } elseif (!(defined('AMP_DB_HOST') && defined('AMP_DB_USER') && defined('AMP_DB_PASS') && defined('AMP_DB_NAME'))) {
        die("Incomplete database configuration. Please contact your system administrator.");
예제 #27
0
파일: UserData.php 프로젝트: radicalsuz/amp
 function _register_fields()
 {
     $md = $this->_module_def;
     $fields = array_map(array(&$this, "_register_fields_filter"), array_keys($md));
     $keys = array('label', 'public', 'type', 'required', 'values', 'lookup', 'size', 'enabled');
     foreach ($fields as $fname) {
         if (!$fname) {
             continue;
         }
         if (!$this->admin) {
             if (!isset($md['enabled_' . $fname])) {
                 continue;
             }
             if (!$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 ($this->admin && $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;
     }
     //override from custom folder
     $override_file_name = 'form' . $this->instance . '.xml';
     $override_fields = false;
     $cache_key = AMP_CACHE_TOKEN_XML_DATA . $override_file_name;
     if (!($override_fields =& AMP_cache_get($cache_key))) {
         if (file_exists_incpath($override_file_name)) {
             require 'AMP/System/XMLEngine.inc.php';
             $fieldsource =& new AMPSystem_XMLEngine($override_file_name);
             $override_fields = $fieldsource->readData();
         }
     }
     if ($override_fields) {
         $this->fields = array_merge($this->fields, $override_fields);
         AMP_cache_set($cache_key, $override_fields);
     }
     return true;
 }
예제 #28
0
 *  Custom Form display page
 *  allows system-side Posts for defined forms
 *  Dependencies:
 *  AMP/CustomForm.php  - defines the AMP_CustomForm class using
 *  HTML::QuickForm engine
 *  custom.forms.inc.php - contains form definitions
 *
 *  URL vars: formname, action=list (shows list of records)
 *  Author: austin@radicaldesigns.org
 *  5/23/2005
 */
require_once 'Connections/freedomrising.php';
require_once 'utility.functions.inc.php';
//Check for the existence of a set of custom forms
$formfile = 'custom.forms.inc.php';
if (file_exists_incpath($formfile)) {
    require_once $formfile;
    //Create an instance of a Custom form definition
    if ($_REQUEST['formname']) {
        $formname = 'AMP_CustomForm_' . $_REQUEST['formname'];
        if (class_exists($formname)) {
            $form =& new $formname($dbcon, true);
        }
    }
}
if (isset($form)) {
    //Check if the form was Submitted with the Save or Delete buttons
    //whether the record ID was already set
    $sub = isset($_REQUEST['btnCustomFormSubmit']) ? $_REQUEST['btnCustomFormSubmit'] : false;
    $del = isset($_REQUEST['btnCustomFormDelete']) ? $_REQUEST['btnCustomFormDelete'] : false;
    $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : false;
예제 #29
0
파일: handler.php 프로젝트: radicalsuz/amp
<?php

require_once 'AMP/System/Base.php';
$request_vars = AMP_URL_Read();
$map_name = isset($request_vars['component']) && $request_vars['component'] ? $request_vars['component'] : false;
if (!$map_name) {
    ampredirect(AMP_SYSTEM_URL_HOME);
    exit;
}
$map_folders = array(AMP_SYSTEM_INCLUDE_PATH, AMP_CONTENT_INCLUDE_PATH, AMP_MODULE_INCLUDE_PATH);
$map_class = false;
foreach ($map_folders as $folder) {
    $test_path = $folder . DIRECTORY_SEPARATOR . $map_name . DIRECTORY_SEPARATOR . AMP_COMPONENT_MAP_FILENAME;
    if (!file_exists_incpath($test_path)) {
        continue;
    }
    include_once $test_path;
    if (!class_exists(AMP_COMPONENT_MAP_CLASSNAME . '_' . $map_name)) {
        continue;
    }
    $map_class = AMP_COMPONENT_MAP_CLASSNAME . '_' . $map_name;
}
if (!$map_class) {
    ampredirect(AMP_SYSTEM_URL_HOME);
    exit;
}
$map =& new $map_class();
$controller =& $map->get_controller();
print $controller->execute();
예제 #30
0
 function form_addElement(&$form, $name, &$field_def, $admin = false)
 {
     if (!(isset($field_def['public']) && $field_def['public']) && !$admin) {
         return false;
     }
     $type = isset($field_def['type']) ? $field_def['type'] : '';
     $label = isset($field_def['label']) ? $field_def['label'] : '';
     $defaults = isset($field_def['values']) ? $field_def['values'] : null;
     if (isset($field_def['lookup']) && is_object($field_def['lookup'])) {
         $defaults = $field_def['lookup']->dataset;
     }
     $size = isset($field_def['size']) ? $field_def['size'] : null;
     $renderer = $form->defaultRenderer();
     if (!$type) {
         return false;
     }
     // Check to see if we have an array of values.
     if (!is_array($defaults)) {
         $defArray = explode(",", $defaults);
         if (count($defArray) > 1) {
             $defaults = array();
             foreach ($defArray as $option) {
                 $defaults[$option] = $option;
             }
         } else {
             $defaults = $defArray[0];
         }
     }
     // Add a default blank value to the select array.
     if (($type == 'select' or $type == 'multiselect' or $type == 'checkgroup' or $type == 'radiogroup') && is_array($defaults)) {
         //Move label into select box for non colonned entries.
         if (substr($label, strlen($label) - 1) != ":") {
             $defaults = array('' => $label) + $defaults;
             $label = "";
         }
         if (isset($field_def['value']) && $field_def['value']) {
             $selected = $field_def['value'];
         }
     }
     //set the search preferences for dates
     if ($type == 'date') {
         $date_preferences = 'form.' . $this->udm->instance . '.date.search.inc.php';
         if (file_exists_incpath($date_preferences)) {
             include_once $date_preferences;
         } else {
             $defaults = array('minYear' => 1990, 'addEmptyOption' => 1, 'emptyOptionText' => '--', 'format' => 'MY');
         }
     }
     //add the element
     $fRef =& $form->addElement($type, $name, $label, $defaults);
     //get the element reference
     //$fRef = $form->getElement( $name );
     if (!$fRef || strtolower(get_class($fRef)) == 'html_quickform_error') {
         return false;
     }
     $fRef->updateAttributes(array('class' => $this->control_class, 'size' => $size));
     if (isset($selected)) {
         $fRef->setSelected($selected);
     }
     if ($type == 'static') {
         $renderer->setElementTemplate(" {label}", $name);
     } elseif ($type == 'checkbox') {
         $renderer->setElementTemplate("{element}  {label} ", $name);
     } else {
         //$renderer->setElementTemplate("\n\t\t<span align=\"right\" valign=\"top\" class=\"".$this->control_class."\">{label} {element}</span\n\t", $name);
         $renderer->setElementTemplate("\n\t\t<span align=\"right\" class=\"" . $this->control_class . "\">{label} {element}</span>\n\t", $name);
     }
     return 1;
 }