~ubuntu-branches/ubuntu/vivid/suphp/vivid

« back to all changes in this revision

Viewing changes to src/Environment.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Emmanuel Lacour
  • Date: 2009-08-03 15:15:38 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090803151538-m9ybo50vm6f0x724
Tags: 0.7.1-1
* New upstream release (closes: #528379, #520182) 
* debian/NEWS: add information about AddHandler -> AddType change introduced
  in 0.6.2-2 (closes: #517805)
* debian/conf/suphp.conf, debian/patches/01_debian.dpatch: switch from
  application/x-httpd-php to application/x-httpd-suphp to allow
  simultaneous use of mod_suphp and mod_php (closes: #519005, #514725)

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
std::string suPHP::Environment::getVar(const std::string& name) const
31
31
    throw (KeyNotFoundException) {
32
32
    if (this->vars.find(name) != this->vars.end()) {
33
 
        return this->vars.find(name)->second;
 
33
        return this->vars.find(name)->second;
34
34
    } else {
35
 
        throw KeyNotFoundException("Key " + name + " not found", 
36
 
                                   __FILE__, __LINE__);
 
35
        throw KeyNotFoundException("Key " + name + " not found", 
 
36
                                   __FILE__, __LINE__);
37
37
    }
38
38
}
39
39
 
40
40
void suPHP::Environment::setVar(const std::string name, 
41
 
                                const std::string content) 
 
41
                                const std::string content) 
42
42
    throw (KeyNotFoundException) {
43
43
    if (this->vars.find(name) != this->vars.end()) {
44
 
        this->vars.find(name)->second = content;
 
44
        this->vars.find(name)->second = content;
45
45
    } else {
46
 
        throw KeyNotFoundException("Key " + name + " not found", 
47
 
                                   __FILE__, __LINE__);
 
46
        throw KeyNotFoundException("Key " + name + " not found", 
 
47
                                   __FILE__, __LINE__);
48
48
    }
49
49
}
50
50
 
51
51
void suPHP::Environment::putVar(const std::string name, 
52
 
                                const std::string content) {
 
52
                                const std::string content) {
53
53
    if (this->vars.find(name) != this->vars.end()) {
54
 
        this->vars.find(name)->second = content;
 
54
        this->vars.find(name)->second = content;
55
55
    } else {
56
 
        std::pair<std::string, std::string> p;
57
 
        p.first = name;
58
 
        p.second = content;
59
 
        this->vars.insert(p);
 
56
        std::pair<std::string, std::string> p;
 
57
        p.first = name;
 
58
        p.second = content;
 
59
        this->vars.insert(p);
60
60
    }
61
61
    
62
62
}
64
64
void suPHP::Environment::deleteVar(const std::string& name) 
65
65
    throw (KeyNotFoundException) {
66
66
    if (this->vars.find(name) != this->vars.end()) {
67
 
        this->vars.erase(name);
 
67
        this->vars.erase(name);
68
68
    } else {
69
 
        throw KeyNotFoundException("Key " + name + " not found",
 
69
        throw KeyNotFoundException("Key " + name + " not found",
70
70
                                   __FILE__, __LINE__);
71
71
    }
72
72
}
73
73
 
74
74
bool suPHP::Environment::hasVar(const std::string& name) const {
75
75
    if (this->vars.find(name) != this->vars.end()) {
76
 
        return true;
 
76
        return true;
77
77
    } else {
78
 
        return false;
 
78
        return false;
79
79
    }
80
80
    
81
81
}
83
83
std::string& suPHP::Environment::operator[](const std::string& name) 
84
84
    throw (KeyNotFoundException) {
85
85
    if (this->vars.find(name) != this->vars.end()) {
86
 
        return this->vars.find(name)->second;
 
86
        return this->vars.find(name)->second;
87
87
    } else {
88
 
        throw KeyNotFoundException("Key " + name + " not found", 
89
 
                                   __FILE__, __LINE__);
 
88
        throw KeyNotFoundException("Key " + name + " not found", 
 
89
                                   __FILE__, __LINE__);
90
90
    }
91
91
}
92
92