Example #1
0
 function register_step_2($data)
 {
     $message = '';
     # Save a temporary user
     $details1['email_address'] = $data['emailaddress'];
     $details1['telephone'] = $data['telephone'];
     $details1['otherphone'] = !empty($data['otherphone']) ? $data['otherphone'] : '';
     $details1['country'] = $data['registration__countries'];
     $details1['user_name'] = trim($data['newusername']);
     $details1['password'] = sha1($data['newpassword']);
     $details1['secret_question_id'] = $data['question__secretquestions'];
     $details1['secret_answer'] = htmlentities($data['secretanswer'], ENT_QUOTES);
     $userId = $this->_query_reader->add_data('save_temp_user', $details1);
     # Create a temporary organization if a temporary user has been saved
     if (!empty($userId)) {
         $details2['name'] = htmlentities($data['businessname'], ENT_QUOTES);
         $details2['description'] = htmlentities($data['description'], ENT_QUOTES);
         $details2['registration_country_id'] = $data['registration__countries'];
         $details2['registration_number'] = !empty($data['registrationno']) ? $data['registrationno'] : '';
         $details2['tax_id'] = !empty($data['taxid']) ? $data['taxid'] : '';
         $details2['category_id'] = $data['organizationtype'] == 'provider' ? $data['category__businesscategories'] : '';
         $details2['ministry_id'] = $data['organizationtype'] == 'pde' ? $data['category__businesscategories'] : '';
         $details2['user_id'] = $userId;
         $organizationId = $this->_query_reader->add_data('save_temp_organization', $details2);
     } else {
         $message = 'Your account details could not be saved.';
     }
     # Then send an email with a verification link for confirmation of contact email
     # Do NOT resend email if user reached this step already
     if (!empty($organizationId) && $this->native_session->get('__step') < 2) {
         $message['code'] = 'account_verification_code';
         $message['verificationcode'] = format_id($userId);
         $message['emailaddress'] = $data['emailaddress'];
         $message['telephone'] = $data['telephone'];
         $message['username'] = $data['newusername'];
         $message['businessname'] = htmlentities($data['businessname'], ENT_QUOTES);
         $result = $this->_messenger->send_direct_email($data['emailaddress'], '', $message);
         if (!$result) {
             $message = 'Your account verification code could not be sent.';
             $results[0] = $this->_query_reader->run('remove_temp_user', array('user_id' => $userId));
             $results[1] = $this->_query_reader->run('remove_temp_organization', array('organization_id' => $organizationId));
         } else {
             $this->native_session->set('__user_id', $userId);
             $this->native_session->set('__organization_id', $organizationId);
             $this->native_session->set('__user_name', $details1['user_name']);
         }
     } else {
         if ($this->native_session->get('__step') > 1) {
             $result = TRUE;
         } else {
             if ($this->native_session->get('__step') < 2) {
                 $message = 'Your account organization could not be saved.';
                 $results[0] = $this->_query_reader->run('remove_temp_user', array('user_id' => $userId));
             }
         }
     }
     return array('result' => !empty($result) && $result ? 'SUCCESS' : 'FAIL', 'reason' => $message);
 }
Example #2
0
function gen_extension_markup(ReflectionExtension $obj, $content, $xml_file)
{
    /* {{{ */
    global $INFO, $OPTION;
    switch ($xml_file) {
        case 'ini.xml':
            if ($ini = ini_get_all($obj->name)) {
                $visibility = array(INI_USER => 'PHP_INI_USER', INI_PERDIR => 'PHP_INI_PERDIR', INI_SYSTEM => 'PHP_INI_SYSTEM', INI_ALL => 'PHP_INI_ALL');
                $ident = get_ident_size('INI_ENTRIES', $content);
                $markup = "<tbody>" . PHP_EOL;
                $markup2 = '';
                foreach ($ini as $config => $value) {
                    $id = "ini." . format_config($config);
                    $markup .= str_repeat(' ', $ident + 1) . "<row>" . PHP_EOL;
                    $markup .= str_repeat(' ', $ident + 2) . "<entry><link linkend=\"" . $id . "\">" . $config . "</link></entry>" . PHP_EOL;
                    $markup .= str_repeat(' ', $ident + 2) . "<entry>" . $value['global_value'] . "</entry>" . PHP_EOL;
                    $markup .= str_repeat(' ', $ident + 2) . "<entry>" . (isset($visibility[$value['access']]) ? $visibility[$value['access']] : $value['access']) . "</entry>" . PHP_EOL;
                    $markup .= str_repeat(' ', $ident + 2) . "<entry><!-- leave empty, this will be filled by an automatic script --></entry>" . PHP_EOL;
                    $markup .= str_repeat(' ', $ident + 1) . "</row>" . PHP_EOL;
                    $markup2 .= ($markup2 ? str_repeat(' ', $ident) : '') . "<varlistentry xml:id=\"" . $id . "\">" . PHP_EOL;
                    $markup2 .= str_repeat(' ', $ident + 1) . "<term>" . PHP_EOL;
                    $markup2 .= str_repeat(' ', $ident + 2) . "<parameter>" . $config . "</parameter>" . PHP_EOL;
                    $markup2 .= str_repeat(' ', $ident + 2) . "<type>" . get_type_by_string($value['global_value']) . "</type>" . PHP_EOL;
                    $markup2 .= str_repeat(' ', $ident + 1) . "</term>" . PHP_EOL;
                    $markup2 .= str_repeat(' ', $ident + 1) . "<listitem>" . PHP_EOL;
                    $markup2 .= str_repeat(' ', $ident + 2) . "<para>" . PHP_EOL;
                    $markup2 .= str_repeat(' ', $ident + 3) . PHP_EOL;
                    $markup2 .= str_repeat(' ', $ident + 2) . "</para>" . PHP_EOL;
                    $markup2 .= str_repeat(' ', $ident + 1) . "</listitem>" . PHP_EOL;
                    $markup2 .= str_repeat(' ', $ident) . "</varlistentry>" . PHP_EOL;
                }
                $markup .= str_repeat(' ', $ident) . "</tbody>";
                /* {INI_ENTRIES} */
                $content = preg_replace('/\\{INI_ENTRIES\\}/', $markup, $content, 1);
                /* {INI_ENTRIES_DESCRIPTION} */
                $content = preg_replace('/\\{INI_ENTRIES_DESCRIPTION\\}/', $markup2, $content, 1);
            } else {
                return false;
                /* Abort */
            }
            break;
        case 'constants.xml':
            if ($constants = $obj->getConstants()) {
                $ident = get_ident_size('CONSTANTS', $content);
                $markup = "&extension.constants;" . PHP_EOL;
                $markup .= str_repeat(' ', $ident) . "<para>" . PHP_EOL;
                $markup .= str_repeat(' ', $ident + 1) . "<variablelist>" . PHP_EOL;
                foreach ($constants as $name => $value) {
                    $markup .= str_repeat(' ', $ident + 2) . '<varlistentry xml:id="constant.' . format_id($name) . '">' . PHP_EOL;
                    $markup .= str_repeat(' ', $ident + 3) . "<term>" . PHP_EOL;
                    $markup .= str_repeat(' ', $ident + 4) . "<constant>" . $name . "</constant>" . PHP_EOL;
                    $markup .= str_repeat(' ', $ident + 4) . "(<type>" . gettype($value) . "</type>)" . PHP_EOL;
                    $markup .= str_repeat(' ', $ident + 3) . "</term>" . PHP_EOL;
                    $markup .= str_repeat(' ', $ident + 3) . "<listitem>" . PHP_EOL;
                    $markup .= str_repeat(' ', $ident + 4) . "<simpara>" . PHP_EOL;
                    $markup .= str_repeat(' ', $ident + 4) . "</simpara>" . PHP_EOL;
                    $markup .= str_repeat(' ', $ident + 3) . "</listitem>" . PHP_EOL;
                    $markup .= str_repeat(' ', $ident + 2) . "</varlistentry>" . PHP_EOL;
                }
                $markup .= str_repeat(' ', $ident + 1) . "</variablelist>" . PHP_EOL;
                $markup .= str_repeat(' ', $ident) . "</para>";
                $content = preg_replace('/\\{CONSTANTS\\}/', $markup, $content, 1);
            } else {
                $content = preg_replace('/\\{CONSTANTS\\}/', '&no.constants;', $content, 1);
            }
            break;
        case 'configure.xml':
            $ident = get_ident_size('EXT_INSTALL_MAIN', $content);
            $ident2 = get_ident_size('EXT_INSTALL_WIN', $content);
            $markup = '';
            $markup2 = '';
            if ($OPTION['pecl'] === true) {
                $markup .= "<para>" . PHP_EOL;
                $markup .= str_repeat(' ', $ident + 1) . "&pecl.info;" . PHP_EOL;
                $markup .= str_repeat(' ', $ident + 1) . "<link xlink:href=\"&url.pecl.package;{EXT_NAME_ID}\">&url.pecl.package;{EXT_NAME_ID}</link>" . PHP_EOL;
                $markup .= str_repeat(' ', $ident) . "</para>" . PHP_EOL;
                /*
                $markup2 .= "<para>". PHP_EOL;
                $markup2 .= str_repeat(' ', $ident2 + 1) ."The latest PECL/{EXT_NAME_ID} Win32 DLL is available here:". PHP_EOL;
                $markup2 .= str_repeat(' ', $ident2 + 1) ."<link xlink:href=\"&url.pecl.win.ext;php_{EXT_NAME_ID}.dll\">php_{EXT_NAME_ID}.dll</link>". PHP_EOL;
                $markup2 .= str_repeat(' ', $ident2) ."</para>". PHP_EOL;
                */
            } else {
                $markup .= "<para>" . PHP_EOL;
                $markup .= str_repeat(' ', $ident + 1) . "Use <option role=\"configure\">--with-{EXT_NAME_ID}[=DIR]</option> when compiling PHP." . PHP_EOL;
                $markup .= str_repeat(' ', $ident) . "</para>" . PHP_EOL;
                $markup2 .= "<para>" . PHP_EOL;
                $markup2 .= str_repeat(' ', $ident2 + 1) . "Windows users should include <filename>php_{EXT_NAME_ID}.dll</filename> into &php.ini;" . PHP_EOL;
                $markup2 .= str_repeat(' ', $ident2) . "</para>" . PHP_EOL;
            }
            $content = str_replace('{EXT_INSTALL_MAIN}', $markup, $content);
            $content = str_replace('{EXT_INSTALL_WIN}', $markup2, $content);
            break;
        case 'versions.xml':
            $version_default = 'PHP 5 &gt;= Unknown';
            if ($OPTION['pecl'] === true) {
                $version_default = 'PECL {EXT_NAME_ID} &gt;= Unknown';
            }
            $markup = "";
            /* Function list */
            if ($functions = $obj->getFunctions()) {
                $markup .= "<!-- Functions -->" . PHP_EOL;
                foreach ($functions as $function) {
                    $markup .= " <function name='" . strtolower($function->getName()) . "' from='{$version_default}'/>" . PHP_EOL;
                }
            }
            /* Method list */
            if ($classes = $obj->getClasses()) {
                $markup .= " <!-- Classes and Methods -->" . PHP_EOL;
                foreach ($classes as $class) {
                    $markup .= PHP_EOL;
                    $markup .= " <function name='" . strtolower($class->name) . "' from='{$version_default}'/>" . PHP_EOL;
                    foreach ($class->getMethods() as $method) {
                        $markup .= " <function name='" . strtolower($class->name . '::' . $method->getName()) . "' from='{$version_default}'/>" . PHP_EOL;
                    }
                }
            }
            $content = preg_replace('/\\{VERSIONS\\}/', rtrim($markup), $content);
            break;
        case 'book.developer.xml':
            if ($OPTION['docbase'] && $OPTION['phpdoc']) {
                $content = preg_replace('/\\{PATH_TO_DOCBASE\\}/', $OPTION['docbase'], $content);
                $content = preg_replace('/\\{PATH_TO_DOC\\}/', $OPTION['phpdoc'], $content);
            }
            break;
    }
    return $content;
}