public function getParameterList($functionName, $style = self::PARAMETERLIST_NUM)
 {
     if ($this->xsd) {
         if (!$this->hasFunction()) {
             if (AUTO_CONFIG_FUNCTIONS === true) {
                 $this->addMissingFunction();
             } else {
                 errorExit(new specificExceptions($this->function, ERR_XSD_MISSING_FUNCTION));
             }
         }
         $xpath = new DOMXPath($this->xsd);
         $xQueryString = '/xs:schema/xs:element[@name="' . $this->class . '"]/xs:complexType/xs:all/xs:element[@name="' . $functionname . '"]/xs:complexType/xs:all/*';
         $xResult = $xpath->query($xQueryString);
         $paramList = array();
         for ($i = 0; $i < $xResult->length; $i++) {
             if ($xResult->item($i)->hasChildNodes()) {
                 $children = $xResult->item($i)->getNodePath();
                 $childResult = $xpath->query($children . '/*/xs:restriction');
                 $type = $childResult->item(0)->getAttribute('base');
                 $patternResult = $xpath->query($children . '/*/xs:restriction/xs:pattern');
                 if ($patternResult->length == 1) {
                     $pattern = $patternResult->item(0)->getAttribute('value');
                 } else {
                     $pattern = $this->getStandardPattern($type);
                 }
             } else {
                 $type = $xResult->item($i)->getAttribute('type');
                 $pattern = $this->getStandardPattern($type);
             }
             if (!$xResult->item($i)->hasAttribute('minOccurs')) {
                 $mandatory = 0;
             } else {
                 $mandatory = $xResult->item($i)->getAttribute('minOccurs');
             }
             if ($style == self::PARAMETERLIST_NUM) {
                 $paramList[] = array("name" => $xResult->item($i)->getAttribute('name'), "mandatory" => $mandatory, "type" => $type, "pattern" => $pattern);
             }
             if ($style == self::PARAMETERLIST_ASSOC) {
                 $paramList[$xResult->item($i)->getAttribute('name')] = array("name" => $xResult->item($i)->getAttribute('name'), "mandatory" => $mandatory, "type" => $type, "pattern" => $pattern);
             }
         }
         return $paramList;
     } else {
         return false;
     }
 }
 public function makeUser($vars)
 {
     $ranPW = self::randomString();
     $db = getDB();
     $db->prepSQL("INSERT INTO user SET userUID=:userUID, userPassword=PASSWORD(:userPassword), userEmail=:userEmail, userVorname=:userVorname, userNachname=:userNachname");
     $db->sendSQL(array("userUID" => $obj->__get("receiverEmail"), "userPassword" => $ranPW, "userEmail" => $obj->__get("receiverEmail"), "userVorname" => $obj->__get("receiverFirstname"), "userNachname" => $obj->__get("receiverLastname")));
     $dbSaveId = $db->lastid();
     if ($dbSaveId == 0) {
         errorExit(new specificExceptions("DB Write Error", ERR_SAVE_ERROR));
     } else {
         $this->rolle2user = new rolle2user();
         $this->rolle2user->__set("userID", $dbSaveId);
         $this->rolle2user->__set("rolleID", "2");
         $dbSaveId2 = $this->rolle2user->save();
         if ($dbSaveId2 = 0) {
             errorExit(new specificExceptions("DB Write Error", ERR_SAVE_ERROR));
         } else {
             $userData = array("ranPW" => $ranPW, "lastID" => $dbSaveId);
             return $userData;
         }
     }
 }
Ejemplo n.º 3
0
            $referer = array();
        }
        if (empty($referer[$host])) {
            $referer[$host] = array();
        }
        if (empty($referer[$host]['begin'])) {
            $referer[$host]['begin'] = time();
        }
        if (empty($referer[$host]['sent'])) {
            $referer[$host]['sent'] = $icon_size;
        }
        $elapsed = time() - $referer[$host]['begin'];
        /* Initialize begin time */
        if ($elapsed > 86400) {
            // 24 * 60 * 60
            $referer[$host]['begin'] = time();
            $referer[$host]['sent'] = 0;
        }
        if ($referer[$host]['sent'] > $favicon_daily_traffic) {
            $approvedToSend = false;
        }
        $referer[$host]['sent'] += $icon_size;
        $f = fopen(REFERER_STAT, "w");
        fwrite($f, serialize($referer));
        fclose($f);
    }
}
if (!$approvedToSend) {
    errorExit(503);
}
dumpWithEtag($icon_path);
Ejemplo n.º 4
0
/**
 * Grab all translatable strings in a file into $strings array
 */
function extractStrings($filename)
{
    global $strings;
    $strings["\n/* {$filename} */"] = array();
    $startSize = count($strings);
    $localStrings = array();
    $data = file_get_contents($filename);
    /*
     * class|inc|php are module and core PHP files.
     * Parse .html as PHP for installer/upgrader templates/*.html files.
     * Parse .css as PHP for modules/colorpack/packs/{name}/color.css files.
     */
    if (preg_match('/\\.(class|inc|php|css|html)$/', $filename)) {
        /* Tokenize PHP code and process to find translate( or i18n( or _( calls */
        $tokens = token_get_all($data);
        for ($i = 0; $i < count($tokens); $i++) {
            if (is_array($tokens[$i]) && $tokens[$i][0] == T_STRING && in_array($tokens[$i][1], array('translate', '_translate', 'i18n', '_')) && $tokens[$i + 1] === '(') {
                /* Found a function call for translation, process the contents */
                for ($i += 2; is_array($tokens[$i]) && $tokens[$i][0] == T_WHITESPACE; $i++) {
                }
                if (is_array($tokens[$i]) && $tokens[$i][0] == T_VARIABLE) {
                    /* Skip translate($variable) */
                    continue;
                }
                for ($buf = '', $parenCount = $ignore = 0; $i < count($tokens); $i++) {
                    /* Fill $buf with translation params; so end at , or ) not in a nested () */
                    if (!$parenCount && ($tokens[$i] === ')' || $tokens[$i] === ',')) {
                        break;
                    }
                    if ($ignore && $parenCount == $ignore && ($tokens[$i] === ',' || $tokens[$i] === ')')) {
                        $ignore = false;
                    }
                    if ($tokens[$i] === '(') {
                        $parenCount++;
                    } else {
                        if ($tokens[$i] === ')') {
                            $parenCount--;
                        }
                    }
                    if (is_array($tokens[$i]) && $tokens[$i][0] == T_CONSTANT_ENCAPSED_STRING) {
                        $lastString = $tokens[$i][1];
                    }
                    if (!$ignore) {
                        $buf .= is_array($tokens[$i]) ? $tokens[$i][1] : $tokens[$i];
                    }
                    if (is_array($tokens[$i]) && $tokens[$i][0] == T_DOUBLE_ARROW && (substr($lastString, 1, 3) === 'arg' || substr($lastString, 1, 5) === 'count')) {
                        /*
                         * Convert 'argN' => code to 'argN' => null so we don't eval that code.
                         * Add 'null' to $buf now, then ignore content until next , or ) not in
                         * a deeper nested ().
                         */
                        $buf .= 'null';
                        $ignore = $parenCount;
                    }
                }
                $param = eval('return ' . $buf . ';');
                if (is_string($param)) {
                    /* Escape double quotes and newlines */
                    $text = strtr($param, array('"' => '\\"', "\r\n" => '\\n', "\n" => '\\n'));
                    $string = 'gettext("' . $text . '")';
                    if (!isset($strings[$string])) {
                        $strings[$string] = array();
                    } else {
                        if (!isset($localStrings[$string])) {
                            $strings[$string][] = $filename;
                        }
                    }
                    $localStrings[$string] = true;
                } else {
                    if (is_array($param)) {
                        foreach (array('text', 'one', 'many') as $key) {
                            if (isset($param[$key])) {
                                /* Escape double quotes and newlines */
                                $param[$key] = strtr($param[$key], array('"' => '\\"', "\r\n" => '\\n', "\n" => '\\n'));
                            }
                        }
                        if (isset($param['one'])) {
                            $string = 'ngettext("' . $param['one'] . '", "' . $param['many'] . '")';
                        } else {
                            $string = 'gettext("' . $param['text'] . '")';
                        }
                        if (isset($param['cFormat'])) {
                            $string = '/* xgettext:' . ($param['cFormat'] ? '' : 'no-') . "c-format */\n{$string}";
                        }
                        if (!empty($param['hint'])) {
                            $string = '// HINT: ' . str_replace("\n", "\n// ", $param['hint']) . "\n{$string}";
                        }
                        if (!isset($strings[$string])) {
                            $strings[$string] = array();
                        } else {
                            if (!isset($localStrings[$string])) {
                                $strings[$string][] = $filename;
                            }
                        }
                        $localStrings[$string] = true;
                    }
                }
            }
        }
    } else {
        if (preg_match_all('/{\\s*g->(?:text|changeInDescendents)\\s+.*?[^\\\\]}/s', $data, $matches)) {
            /* Use regexp to process tpl files for {g->text ..} and {g->changeInDescendents ..} */
            foreach ($matches[0] as $string) {
                $text = $one = $many = null;
                /*
                 * Ignore translations of the form:
                 *   text=$foo
                 * as we expect those to be variables containing values that
                 * have been marked elsewhere with the i18n() function.
                 */
                if (preg_match('/\\stext=\\$/', $string)) {
                    continue;
                }
                /* text=..... */
                if (preg_match('/\\stext="(.*?[^\\\\])"/s', $string, $matches)) {
                    $text = $matches[1];
                } else {
                    if (preg_match("/text='(.*?)'/s", $string, $matches)) {
                        $text = str_replace('"', '\\"', $matches[1]);
                        /* Escape double quotes */
                    }
                }
                /* one=..... */
                if (preg_match('/\\sone="(.*?[^\\\\])"/s', $string, $matches)) {
                    $one = $matches[1];
                } else {
                    if (preg_match("/\\sone='(.*?)'/s", $string, $matches)) {
                        $one = str_replace('"', '\\"', $matches[1]);
                        /* Escape double quotes */
                    }
                }
                /* many=..... */
                if (preg_match('/\\smany="(.*?[^\\\\])"/s', $string, $matches)) {
                    $many = $matches[1];
                } else {
                    if (preg_match("/\\smany='(.*?)'/s", $string, $matches)) {
                        $many = str_replace('"', '\\"', $matches[1]);
                        /* Escape double quotes */
                    }
                }
                /* Hint for translators */
                $translatorHint = preg_match('/\\shint=((["\']).*?[^\\\\]\\2)/s', $string, $matches) ? eval('return ' . $matches[1] . ';') : '';
                /* c-format hint for xgettext */
                $cFormatHint = preg_match('/\\sc[Ff]ormat=(true|false)/s', $string, $matches) ? '/* xgettext:' . ($matches[1] == 'false' ? 'no-' : '') . "c-format */\n" : '';
                /* Pick gettext() or ngettext() and escape newlines */
                if (isset($text)) {
                    $string = 'gettext("' . strtr($text, array("\r\n" => '\\n', "\n" => '\\n')) . '")';
                } else {
                    if (isset($one) && isset($many)) {
                        $string = 'ngettext("' . strtr($one, array("\r\n" => '\\n', "\n" => '\\n')) . '", "' . strtr($many, array("\r\n" => '\\n', "\n" => '\\n')) . '")';
                    } else {
                        /* Parse error */
                        $string = str_replace("\n", '\\n> ', $string);
                        errorExit("extract.php parse error: {$filename}:\n> {$string}\n");
                    }
                }
                if ($cFormatHint) {
                    $string = $cFormatHint . $string;
                }
                if ($translatorHint) {
                    $string = "// HINT: {$translatorHint}\n{$string}";
                }
                if (!isset($strings[$string])) {
                    $strings[$string] = array();
                } else {
                    if (!isset($localStrings[$string])) {
                        $strings[$string][] = $filename;
                    }
                }
                $localStrings[$string] = true;
            }
        }
    }
    if (count($strings) == $startSize) {
        unset($strings["\n/* {$filename} */"]);
    }
}
Ejemplo n.º 5
0
    }
    if (count($entries) === 1) {
        unset($paging);
    }
    fireEvent('OBStart');
    require ROOT . '/interface/common/blog/begin.php';
    if (empty($entries)) {
        header('HTTP/1.1 404 Not Found');
        if (empty($skin->pageError)) {
            dress('article_rep', fireEvent('ViewErrorPage', '<div class="TCwarning">' . _text('존재하지 않는 페이지입니다.') . '</div>'), $view);
        } else {
            dress('article_rep', NULL, $view);
            dress('page_error', fireEvent('ViewErrorPage', $skin->pageError), $view);
        }
        unset($paging);
    } else {
        require ROOT . '/interface/common/blog/entries.php';
    }
    require ROOT . '/interface/common/blog/end.php';
    fireEvent('OBEnd');
} else {
    if (!empty($freeSlogan)) {
        errorExit(404);
    }
    list($entries, $paging) = getEntriesWithPagingByPage($blogid, $suri['page'], $blog['entriesOnPage']);
    fireEvent('OBStart');
    require ROOT . '/interface/common/blog/begin.php';
    require ROOT . '/interface/common/blog/entries.php';
    require ROOT . '/interface/common/blog/end.php';
    fireEvent('OBEnd');
}
Ejemplo n.º 6
0
                        $action = new Action_default();
                        $GLOBALS['AA_ERROR'] = "System error: Action '" . $_POST['act'] . "' not defined in controller.php";
                        errorExit($action);
                    }
                }
            }
        }
    }
}
//
//	process action
//
$action->process();
// process requested action
if (!empty($GLOBALS['AA_ERROR'])) {
    errorExit($action);
}
//
// HTML Header
//
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <title>controller</title>
</head>
Ejemplo n.º 7
0
    $comment = $excerpt;
}
$p = $Blog->getnewsbyid($id);
if (!$p) {
    errorExit('Article not found');
}
$p = $p->fetch_object();
if (!$p) {
    errorExit('Article not found');
}
$mytitle = $p->title;
$myurl = $Blog->rootpath . '/' . $p->id . '/' . $Blog->shorttext($mytitle);
##errorExit($myurl);
#if(strpos($comment, $myurl) !== false) errorExit('Go away, spammer');
$comment = strip_tags($comment);
$comment = nl2br($comment);
if (isset($_POST['title'])) {
    $title = htmlspecialchars($_POST['title']);
    $comment = "<strong>{$title}</strong><br />" . $comment;
}
if ($Blog->save_comment($id, $blog_name, '', $url, $comment, false)) {
    header("Content-type: text/xml");
    echo <<<EOF
<?xml version="1.0" encoding="utf-8"?>
<response>
 <error>0</error>
</response>
EOF;
} else {
    errorExit('Trackback cannot be saved');
}
Ejemplo n.º 8
0
                }
                $location = PP_DB_URL . "{$dest_dir}/{$dest_file}{$extra_ext}";
                #system("ls -lrt ".PP_DB."$dest_dir/$dest_file 2>&1");
            } else {
                bugPage("Cannot copy " . $_FILES["preprint"]["tmp_name"] . " -> " . PP_DB . "{$dest_dir}/{$dest_file}");
            }
            break;
        case UPLOAD_ERR_NO_FILE:
            break;
        case UPLOAD_ERR_INI_SIZE:
        case UPLOAD_ERR_FORM_SIZE:
            errorExit("File exceeds maximum file size.");
        case UPLOAD_ERR_PARTIAL:
            errorExit("File upload was incomplete.");
        default:
            errorExit("An unknown error occured during file upload.");
    }
}
$q = $dbClass->query("SELECT * FROM publications WHERE RowId=" . $dbClass->quote($rowId));
$row = $dbClass->next_record($q);
$status = $row["Status"];
if ($status == "reserved" && !(empty($location) && empty($journal)) && !empty($authors) && !empty($title)) {
    $status = "registered";
    mail2secretary("Registered");
    logIt("register", pp_preprintID($row["Year"], $row["Report"]), uid2gecos($res_UID));
    unset($pp_id);
}
$dbClass->query("UPDATE publications SET " . " Field=" . $dbClass->quote($field) . ",Location=" . $dbClass->quote($location) . ",Authors=" . $dbClass->quote($authors) . ",Title=" . $dbClass->quote($title) . ",PublIn=" . $dbClass->quote($journal) . ",Id=" . $dbClass->quote($res_UID) . ",Status=" . $dbClass->quote($status) . " WHERE RowId=" . $dbClass->quote($rowId));
if ($pp_id) {
    logIt("edit", $pp_id, uid2gecos($res_UID));
}