Beispiel #1
0
/**
 * Make the functions.dat file
 */
function make_functions_dat()
{
    $files = make_functions_dat_do_dir(get_custom_file_base());
    $classes = array();
    $global = array();
    foreach ($files as $filename) {
        if (strpos($filename, '_custom') !== false) {
            continue;
        }
        $_filename = substr($filename, strlen(get_custom_file_base()) + 1);
        if ($_filename == 'sources/minikernel.php') {
            continue;
        }
        $result = get_php_file_api($_filename, false);
        foreach ($result as $i => $r) {
            if ($r['name'] == '__global') {
                $global = array_merge($global, $r['functions']);
                unset($result[$i]);
            }
        }
        $classes = array_merge($classes, $result);
    }
    $classes['__global'] = array('functions' => $global);
    $myfile = @fopen(get_custom_file_base() . '/data_custom/functions.dat', 'wt') or intelligent_write_error(get_custom_file_base() . '/data_custom/functions.dat');
    if (fwrite($myfile, serialize($classes)) == 0) {
        warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
    }
    fclose($myfile);
}
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_code('type_validation');
     require_lang('phpdoc');
     require_code('php');
     require_css('adminzone');
     disable_php_memory_limit();
     $filename = (array_key_exists('param', $map) ? $map['param'] : 'sources/global2') . '.php';
     if (substr($filename, -8) == '.php.php') {
         $filename = substr($filename, 0, strlen($filename) - 4);
     }
     $full_path = (get_file_base() != '' ? get_file_base() . '/' : '') . filter_naughty($filename);
     if (!file_exists($full_path)) {
         return paragraph(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $_classes = get_php_file_api($filename);
     $classes = new ocp_tempcode();
     foreach ($_classes as $class) {
         if ($class['name'] == '__global') {
             $class['name'] = do_lang('GLOBAL_FUNCTIONS') . '_' . basename($filename);
         }
         $function_summaries = new ocp_tempcode();
         $functions = new ocp_tempcode();
         foreach ($class['functions'] as $function) {
             $ret = render_php_function($function, $class);
             $functions->attach($ret[0]);
             $function_summaries->attach($ret[1]);
         }
         $classes->attach(do_template('PHP_CLASS', array('_GUID' => '5d58fc42c5fd3a5dd190f3f3699610c2', 'CLASS_NAME' => $class['name'], 'FUNCTION_SUMMARIES' => $function_summaries, 'FUNCTIONS' => $functions)));
     }
     return do_template('PHP_FILE', array('_GUID' => '6f422e6a6e846d49864d7325b212109f', 'FILENAME' => $filename, 'CLASSES' => $classes));
 }
Beispiel #3
0
 }
 $TO_USE = $filename;
 if ($filename == 'phpstub.php') {
     $_filename = 'phpstub.php';
     $TO_USE = getcwd() . DIRECTORY_SEPARATOR . 'phpstub.php';
 } else {
     $_filename = $OCPORTAL_PATH == '' ? $filename : substr($filename, strlen($OCPORTAL_PATH) + 1);
 }
 if ($_filename == 'sources' . DIRECTORY_SEPARATOR . 'minikernel.php') {
     continue;
 }
 //echo 'SIGNATURES-DOING '.$_filename.cnl();
 if (strpos($_filename, '_tests' . DIRECTORY_SEPARATOR) === 0) {
     $result = array();
 } else {
     $result = get_php_file_api($_filename, false);
 }
 if (strpos($filename, '_custom') !== false) {
     continue;
 }
 foreach ($result as $i => $r) {
     if ($r['name'] == '__global') {
         if ($_filename != 'sources' . DIRECTORY_SEPARATOR . 'global.php' && $_filename != 'phpstub.php' && $_filename != 'tempcode_compiler__runtime' && $_filename != 'tempcode_compiler') {
             foreach (array_keys($r['functions']) as $f) {
                 if (isset($global[$f]) && !in_array($f, array('file_get_contents', 'ftp_chmod', 'html_entity_decode', 'str_ireplace', 'str_word_count', 'do_lang', 'mixed', 'qualify_url', 'http_download_file', 'get_forum_type', 'ocp_srv', 'mailto_obfuscated', 'get_custom_file_base'))) {
                     echo 'DUPLICATE-FUNCTION ' . $f . ' (in ' . $filename . ')' . cnl();
                 }
             }
         }
         $global = array_merge($global, $r['functions']);
     }