Changeset 14084

Show
Ignore:
Timestamp:
12/22/07 06:04:55 (10 months ago)
Author:
flack
Message:

The PHPdoc Massacre, Part 1

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/cc.kaktus.pearserver/admin.php

    r6173 r14084  
    11<?php 
    22/** 
    3  * @package cc.kaktus_pearserver 
     3 * @package cc.kaktus.pearserver 
    44 * @author The Midgard Project, http://www.midgard-project.org 
    55 * @version $Id: admin.php 3145 2006-03-22 18:52:19Z torben $ 
  • trunk/midcom/cc.kaktus.pearserver/handler/channel.php

    r6173 r14084  
    11<?php 
     2/** 
     3 * @package cc.kaktus.pearserver 
     4 * @author The Midgard Project, http://www.midgard-project.org 
     5 * @copyright The Midgard Project, http://www.midgard-project.org 
     6 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License 
     7 */ 
    28 
    39?> 
  • trunk/midcom/cc.kaktus.pearserver/handler/config.php

    r11184 r14084  
    22/** 
    33 * @package cc.kaktus.pearserver 
    4  * @author The Midgard Project, http://www.midgard-project.org  
     4 * @author The Midgard Project, http://www.midgard-project.org 
    55 * @version $Id: viewer.php 4368 2006-10-20 07:47:46Z rambo $ 
    66 * @copyright The Midgard Project, http://www.midgard-project.org 
     
    1717    /** 
    1818     * Constructor. Ties to the parent class constructor. 
    19      *  
     19     * 
    2020     * @access public 
    2121     */ 
     
    2525        $this->_root_group =& $this->_request_data['root_group']; 
    2626    } 
    27      
     27 
    2828    /** 
    2929     * Load the DM2 controller instance 
    30      *  
     30     * 
    3131     * @access private 
    3232     */ 
     
    3535        // Get the configuration schema 
    3636        $this->_schemadb_config = midcom_helper_datamanager2_schema::load_database('file:/cc/kaktus/pearserver/config/schemadb_config.inc'); 
    37          
     37 
    3838        // Create the controller 
    3939        $this->_controller =& midcom_helper_datamanager2_controller::create('simple'); 
    4040        $this->_controller->schemadb =& $this->_schemadb_config; 
    4141        $this->_controller->set_storage($this->_topic); 
    42          
     42 
    4343        if (! $this->_controller->initialize()) 
    4444        { 
     
    4747        } 
    4848    } 
    49      
     49 
    5050    /** 
    5151     * Require the correct ACL's for configuring 
    52      *  
     52     * 
    5353     * @access public 
    5454     */ 
     
    5757        $this->_topic->require_do('midgard:update'); 
    5858        $this->_topic->require_do('midgard:config'); 
    59          
     59 
    6060        $this->_load_controller(); 
    61          
     61 
    6262        switch ($this->_controller->process_form()) 
    6363        { 
     
    6565                $_MIDCOM->uimessages->add('cc.kaktus.pearserver', $this->_l10n->get('configuration saved')); 
    6666                // Fall through 
    67                  
     67 
    6868            case 'cancel': 
    6969                $_MIDCOM->relocate(''); 
    7070                break; 
    7171        } 
    72          
     72 
    7373        // Set the breadcrumb 
    7474        $tmp = array(); 
     
    7878            MIDCOM_NAV_NAME => $this->_l10n_midcom->get('component configuration'), 
    7979        ); 
    80          
     80 
    8181        $_MIDCOM->set_custom_context_data('midcom.helper.nav.breadcrumb', $tmp); 
    82          
     82 
    8383        return true; 
    8484    } 
    85      
     85 
    8686    /** 
    8787     * Show the configuration screen 
    88      *  
     88     * 
    8989     * @access public 
    9090     */ 
     
    9292    { 
    9393        $data['controller'] =& $this->_controller; 
    94          
     94 
    9595        midcom_show_style('pearserver-configuration'); 
    9696    } 
  • trunk/midcom/cc.kaktus.pearserver/handler/process.php

    r11182 r14084  
    22/** 
    33 * @package cc.kaktus.pearserver 
    4  * @author The Midgard Project, http://www.midgard-project.org  
     4 * @author The Midgard Project, http://www.midgard-project.org 
    55 * @version $Id: viewer.php 4368 2006-10-20 07:47:46Z rambo $ 
    66 * @copyright The Midgard Project, http://www.midgard-project.org 
     
    1919        parent::midcom_baseclasses_components_handler(); 
    2020    } 
    21      
     21 
    2222    function _process_attachment($attachment) 
    2323    { 
     
    2929        echo time(); 
    3030        die(); 
    31                  
     31 
    3232        // New filename for copying the package 
    3333        $new_name = "{$tmp_dir}{$attachment->name}"; 
    34          
     34 
    3535        while (is_dir($tmp_dir)) 
    3636        { 
     
    3838            $tmp_dir = "/tmp/" . md5($tmp_dir) . "/"; 
    3939        } 
    40          
     40 
    4141        echo "-- directory will be {$tmp_dir}\n"; 
    42          
     42 
    4343        if (!mkdir($tmp_dir)) 
    4444        { 
    4545            debug_add("Failed to create directory '{$tmp_dir}'", MIDCOM_LOG_ERROR); 
    4646            debug_pop(); 
    47              
     47 
    4848            $_MIDCOM->generate_error(MIDCOM_ERRCRIT, 'Failed to process the attachments, see error level log for details'); 
    4949            // This will exit 
    5050        } 
    51          
     51 
    5252        echo "-- created {$tmp_dir}\n"; 
    53          
     53 
    5454        debug_add("Created directory '{$tmp_dir}' for temporary use"); 
    55          
     55 
    5656        // Create a temporary file for unpacking 
    5757        $tmp_file = fopen($new_name, 'w'); 
    58          
     58 
    5959        echo "-- writing {$tmp_file}\n"; 
    6060        $i = 1; 
    61          
     61 
    6262        fwrite ($tmp_file, file_get_contents($handle)); 
    63          
     63 
    6464        preg_match('/\.(zip|tar(\.gz|\.bz2)?|tgz)$/', strtolower($attachment->name), $regs); 
    65          
     65 
    6666        switch ($regs[1]) 
    6767        { 
     
    8686                debug_add("executing '{$cmd}'"); 
    8787                exec($cmd, $output, $ret); 
    88                  
     88 
    8989                $this->_errors[] = array 
    9090                ( 
     
    9393                    'message' => 'unknown file type', 
    9494                ); 
    95                  
     95 
    9696                // Remove the false attachment 
    9797                $attachment->delete(); 
    98                  
     98 
    9999                $this->_flush_temporary_directory($tmp_dir); 
    100                  
     100 
    101101                return false; 
    102102        } 
    103          
     103 
    104104        debug_add("executing '{$extract_cmd}'"); 
    105105        exec($extract_cmd, $output, $ret); 
    106          
     106 
    107107        echo "-- {$extract_cmd}\n"; 
    108          
     108 
    109109        if ($ret != 0) 
    110110        { 
     
    112112            debug_add("Failed to execute '{$extract_cmd}'", MIDCOM_LOG_ERROR); 
    113113            debug_pop(); 
    114              
    115             echo "-- failed to execute!\n";  
    116              
     114 
     115            echo "-- failed to execute!\n"; 
     116 
    117117            $this->_errors[] = array 
    118118            ( 
     
    121121                'message' => 'failed to unpack', 
    122122            ); 
    123              
     123 
    124124            $this->_flush_temporary_directory($tmp_dir); 
    125125            return false; 
    126126        } 
    127          
     127 
    128128        if (!file_exists("{$tmp_dir}package.xml")) 
    129129        { 
     
    135135            ); 
    136136        } 
    137          
     137 
    138138        $manifest = file_get_contents("{$tmp_dir}package.xml"); 
    139          
     139 
    140140        debug_add("Got the manifest:\n{$manifest}"); 
    141          
     141 
    142142        $attachment->set_parameter('PEAR package', 'manifest.inc', $manifest); 
    143          
     143 
    144144        $this->_flush_temporary_directory($tmp_dir); 
    145          
     145 
    146146        debug_pop(); 
    147147        return true; 
    148148    } 
    149      
     149 
    150150    function _flush_temporary_directory($directory) 
    151151    { 
     
    154154        debug_add("executing '{$exec}'"); 
    155155        exec($exec, $output, $ret); 
    156          
     156 
    157157        debug_add("Execute returned {$output}"); 
    158158    } 
    159      
     159 
    160160    function _handler_process($handler_id, $args, &$data) 
    161161    { 
    162162        $this->_release = new org_openpsa_products_product($args[0]); 
    163          
     163 
    164164        echo "<pre>\n"; 
    165          
     165 
    166166        // Get the attachments for the currently processed release 
    167167        $qb = midcom_baseclasses_database_attachment::new_query_builder(); 
     
    169169        $qb->add_constraint('ptable', '=', 'org_openpsa_products_product'); 
    170170        $this->_attachments = $qb->execute_unchecked(); 
    171          
     171 
    172172        print_r($this->_attachments); 
    173          
     173 
    174174        foreach ($this->_attachments as $attachment) 
    175175        { 
    176176            $this->_process_attachment($attachment); 
    177177        } 
    178          
     178 
    179179        echo "</pre>\n"; 
    180180        die(); 
  • trunk/midcom/cc.kaktus.pearserver/handler/upload.php

    r11182 r14084  
    22/** 
    33 * @package cc.kaktus.pearserver 
    4  * @author The Midgard Project, http://www.midgard-project.org  
     4 * @author The Midgard Project, http://www.midgard-project.org 
    55 * @version $Id: viewer.php 4368 2006-10-20 07:47:46Z rambo $ 
    66 * @copyright The Midgard Project, http://www.midgard-project.org 
     
    1818    var $_tmpfile; 
    1919    var $_filename; 
    20      
     20 
    2121    var $_attachment; 
    22      
     22 
    2323    /** 
    2424     * Constructor. Ties to the parent class constructor. 
    25      *  
     25     * 
    2626     * @access public 
    2727     */ 
     
    3131        $this->_root_group =& $this->_request_data['root_group']; 
    3232    } 
    33      
     33 
    3434    /** 
    3535     * Unpack the file for processing 
    36      *  
     36     * 
    3737     * @access private 
    3838     * @return boolean 
     
    4141    { 
    4242        debug_push_class(__CLASS__, __FUNCTION__); 
    43          
     43 
    4444        // Check the extension 
    4545        if (!preg_match('/\.(zip|tar(\.gz|\.bz2)?|tgz)$/', strtolower($this->_filename), $regs)) 
     
    4747            debug_add("Illegal file extension: '{$this->_filename}'"); 
    4848            debug_pop(); 
    49              
     49 
    5050            $_MIDCOM->uimessages->add($this->_l10n->get('cc.kaktus.pearserver'), sprintf($this->_l10n->get("unknown file type %s"), $regs[1])); 
    5151            return false; 
    5252        } 
    53          
     53 
    5454        $extension = $regs[1]; 
    5555        $this->_tmpdir = "{$this->_tmpfile}_extracted"; 
    56          
     56 
    5757        // Get the correct unpacking routine 
    5858        switch (strtolower($extension)) 
     
    7676                debug_add("Illegal file extension: '{$this->_tmpfile}'"); 
    7777                debug_pop(); 
    78                  
     78 
    7979                $_MIDCOM->uimessages->add($this->_l10n->get('cc.kaktus.pearserver'), sprintf($this->_l10n->get("unknown file type %s"), $extension)); 
    8080                return false; 
    8181        } 
    82          
     82 
    8383        // Create a temporary directory for unpacking 
    8484        if (!mkdir($this->_tmpdir)) 
     
    8787            debug_add('Failed to create a temporary directory. Check the write permissions of the HTTPD services', MIDCOM_LOG_ERROR); 
    8888            debug_pop(); 
    89              
     89 
    9090            $this->_flush($this->_tmpfile); 
    91              
     91 
    9292            $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Failed to create a temporary directory. See error level log for details"); 
    9393            // This will exit 
    9494        } 
    95          
     95 
    9696        // Extract the package 
    9797        debug_add("Executing '{$extract_cmd}'"); 
     
    102102            debug_add("Failed to execute '{$extract_cmd}'", MIDCOM_LOG_ERROR); 
    103103            debug_pop(); 
    104              
     104 
    105105            // Flush the temporary files 
    106106            $this->_flush(); 
    107107            return false; 
    108108        } 
    109          
     109 
    110110//        $cmd = 'cp ' . escapeshellarg($v) . ' ' . escapeshellarg($new_v); 
    111          
     111 
    112112        // Print the file listing 
    113113        $this->_check_shell_args(); 
    114          
     114 
    115115        // Get the package XML 
    116116        $this->_parse_package(); 
    117          
     117 
    118118        // Flush the temporary files 
    119119        $this->_flush(); 
    120          
    121         return true; 
    122     } 
    123      
     120 
     121        return true; 
     122    } 
     123 
    124124    function _parse_package() 
    125125    { 
     
    129129            return false; 
    130130        } 
    131          
     131 
    132132        $contents = file_get_contents("{$this->_tmpdir}/package.xml"); 
    133133        echo "<pre>{$contents}</pre>\n"; 
    134          
     134 
    135135        $this->_package = $contents; 
    136          
    137         return true; 
    138     } 
    139      
     136 
     137        return true; 
     138    } 
     139 
    140140    /** 
    141141     * Before accepting the package files should be checked to verify that the extracted files do not contain 
    142142     * shell arguments 
    143      *  
     143     * 
    144144     * @access private 
    145145     */ 
     
    151151            return; 
    152152        } 
    153          
     153 
    154154        // TODO: write a checkup routine 
    155155        while (($file = readdir($dp)) !== false) 
     
    157157            echo "{$file}\n"; 
    158158        } 
    159           
    160         return true; 
    161     } 
    162      
     159 
     160        return true; 
     161    } 
     162 
    163163    /** 
    164164     * Empty the temporary files and directories 
    165      *  
     165     * 
    166166     * @access private 
    167167     */ 
     
    169169    { 
    170170