Example #1
0
 function Start()
 {
     //no cache for post
     if (strToUpper($_SERVER['REQUEST_METHOD']) == 'POST') {
         return;
     }
     //no cache for sessions
     if (count($_SESSION)) {
         return;
     } else {
         @session_destroy();
     }
     //construct cache name
     $this->name = $this->prefix . rawUrlEncode($_SERVER['SCRIPT_FILENAME']) . rawUrlEncode($_SERVER['QUERY_STRING']) . '.hTm';
     //check for cache
     if (!file_exists($this->dir . '/' . $this->name)) {
         ob_start();
     } else {
         $STAT = @stat($this->dir . '/' . $this->name);
         if ($STAT[9] + $this->expire > time() && $STAT[7] > 0) {
             echo "<!--start of cached version (", date('D, M-d-Y H:i:s', $STAT[9]), ")-->\n";
             readfile($this->dir . '/' . $this->name);
             die("\n<!--end of cached version-->");
         } else {
             $this->force = $this->dir . '/' . $this->name;
             echo "<!--detected expired cached version (" . date('D, M-d-Y H:i:s', $STAT[9]) . ")-->\n";
         }
     }
 }
Example #2
0
 /**
  * add a new field definition (this function will replace "addField")
  * @since Version 1.1.0
  *
  * @param string $label
  * @param string $field_name
  * @param string $field_type
  * @param mixed $width
  * @param array $extraData
  * @return array with field definition
  */
 public function addSimpleField($label, $field_name, $field_type, $width = null, array $extraData = array())
 {
     $data = array();
     $data['label'] = $label;
     $data['field'] = $field_name;
     $data['type'] = strToUpper($field_type);
     $data['width'] = $width;
     if (isset($extraData['align'])) {
         $data['align'] = $extraData['align'];
     } else {
         $data['align'] = $this->getDefaultAlign($field_type);
     }
     if (isset($extraData['sortable'])) {
         $data['sortable'] = $extraData['sortable'];
     } else {
         $data['sortable'] = false;
     }
     if (isset($extraData['order_fields'])) {
         $data['order_fields'] = $extraData['order_fields'];
     } else {
         $data['order_fields'] = $field_name;
     }
     if (isset($extraData['format'])) {
         $data['format'] = $extraData['format'];
     } else {
         $data['format'] = false;
     }
     if (isset($extraData['number_format'])) {
         $data['number_format'] = $extraData['number_format'];
     } else {
         $data['number_format'] = false;
     }
     $this->fields[] = $data;
     return $data;
 }
Example #3
0
 /**
  * Factory
  *
  * @param string $format MO or PO
  * @param string $file   path to GNU gettext file
  *
  * @static
  * @access  public
  * @return  object  Returns File_Gettext_PO or File_Gettext_MO on success
  *                  or PEAR_Error on failure.
  */
 function factory($format, $file = '')
 {
     $format = strToUpper($format);
     $class = 'File_Gettext_' . $format;
     $obref = new $class($file);
     return $obref;
 }
Example #4
0
/**
 * Converts a dash separated string into a camel case string.
 * @param  string $str Dash separated string.
 * @return string      Camel cased string.
 */
function toCamelCase($str)
{
    while (($index = strpos($str, '-')) !== false) {
        $str = substr($str, 0, $index) . strToUpper(substr($str, $index + 1, 1)) . substr($str, $index + 2);
    }
    return $str;
}
Example #5
0
 /**
  * Shortcut method for fetching an URL
  * @param string $url
  * @return string the fetched HTML
  */
 protected function download($url)
 {
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     //curl_setopt($ch, CURLINFO_HEADER_OUT, true);
     curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
     curl_setopt($ch, CURLOPT_URL, $url);
     $u = parse_url($url);
     $cookie_txt = '/tmp/' . strToUpper($u['host']) . '.txt';
     curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_txt);
     curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_txt);
     curl_setopt($ch, CURLOPT_USERAGENT, $this->user_agent);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     //curl_setopt($ch, CURLOPT_VERBOSE, 1);
     //curl_setopt($ch, CURLOPT_HEADER, 1);
     $response = curl_exec($ch);
     if (false === $response) {
         throw new Exception(curl_error($ch) . ' (' . curl_errno($ch) . ')');
     }
     if (200 != ($code = curl_getinfo($ch, CURLINFO_HTTP_CODE))) {
         throw new Exception("Response code is not 200, but {$code}; " . curl_getinfo($ch, CURLINFO_HEADER_OUT));
     }
     curl_close($ch);
     return $response;
 }
 /**
  *  Obtain the request variables for the desired type
  *  @name    _collect
  *  @type    method
  *  @access  protected
  *  @return  void
  */
 protected function _collect()
 {
     //  determine the collection and try to populate it's properties
     switch ($this->_type) {
         //  use PHP's built-in _GET and/or _POST superglobals, override after copying
         case 'get':
         case 'post':
             $super = '_' . strToUpper($this->_type);
             if (isset($GLOBALS[$super]) && is_array($GLOBALS[$super])) {
                 $buffer = $this->_type === 'get' ? $this->call('/Tool/serverVal', 'QUERY_STRING') : trim(file_get_contents('php://input'));
                 $this->_populate($GLOBALS[$super], $buffer);
             }
             $GLOBALS[$super] = $this;
             break;
             //  provide PUT and DELETE support
         //  provide PUT and DELETE support
         case 'put':
         case 'delete':
             $super = '_' . strToUpper($this->_type);
             if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == strToUpper($this->_type)) {
                 $raw = trim(file_get_contents("php://input"));
                 if (!empty($raw)) {
                     parse_str($raw, $temp);
                     $this->_populate($temp, $raw);
                 }
             }
             $GLOBALS[$super] = $this;
             break;
         default:
             $this->call('/Log/message', 'Unsupported request type: ' . $this->_type, 1);
             break;
     }
 }
Example #7
0
 function __construct($namespace = "zmax")
 {
     $this->_namespace = $namespace;
     $this->_nsLength = strlen($namespace);
     // Keep also the Uppercase version (SAX gives everything in uppercase)
     $this->_nsUpper = strToUpper($namespace);
 }
Example #8
0
 public static function decode($source)
 {
     $num = sizeof(self::$bArr);
     $len = strlen($source);
     $out = 0;
     if (3 > $len) {
         throw new \Exception("Given code ({$source}} is too short; at least 3 letters expected.");
     }
     if (1 != $len % 2) {
         throw new \Exception("Wrong code ({$source}} given.");
     }
     if ($len != $num * 2 - 1) {
         throw new \Exception("Given code ({$source}} doesn't match given number size.");
     }
     $tmp = array();
     for ($i = 0; $i < $len; $i += 2) {
         array_unshift($tmp, strToLower($source[$i]));
     }
     $exp = 1;
     foreach ($tmp as $i => $v) {
         $p = strpos(self::$bArr[$i], $v);
         if (false === $p) {
             $v = strToUpper($v);
             throw new \Exception("Index \"{$v}\" not found in ({$source}), at least 2 required.");
         }
         $out += $p * $exp;
         $exp = $exp * 20;
     }
     $p = strpos(self::$aArr, strToLower($source[1]));
     if ($p != $out % 5) {
         throw new \Exception("Control number in ({$source}) doesn't match.");
     }
     return $out;
 }
Example #9
0
function colesoStrToUpper($str)
{
    $localeData = colesoApplication::getConfigVal('/system/localeData');
    if (isset($localeData['isMultiByte'])) {
        return mb_strtoupper($str, $localeData['encoding']);
    }
    return strToUpper($str);
}
Example #10
0
 public function checkPerm()
 {
     $act = 'SET';
     $name = strToUpper($this->baseName);
     if (!$this->auth->hasPerm($act, $name)) {
         die(sprintf(_("PERMISSION DENIED [%s/%s]"), $act, $name));
     }
 }
 public static function strToHex($string, $addEmptyByte = false)
 {
     $hex = '';
     for ($i = 0; $i < strlen($string); $i++) {
         $hex .= ($addEmptyByte ? "00" : "") . substr('0' . dechex(ord($string[$i])), -2);
     }
     return strToUpper($hex);
 }
Example #12
0
 public static function strToHex($string)
 {
     $hex = '';
     for ($i = 0; $i < strlen($string); $i++) {
         $hex .= substr('0' . dechex(ord($string[$i])), -2);
     }
     return strToUpper($hex);
 }
Example #13
0
 /**
  * @return string
  * @param srting $id
  */
 public function lang($id = null)
 {
     if (null !== $id) {
         $this->lang = strToUpper($id);
         $this->plural = null;
     }
     return $this->lang;
 }
Example #14
0
 /**
  * @return string
  * @param $type
  */
 public function toSql($type = null)
 {
     if (null === $type) {
         $type = Nano::db()->getType();
     }
     $format = 'Date::FORMAT_' . strToUpper($type);
     return $this->format(constant($format));
 }
Example #15
0
    /**
     * Send a bunch of files or directories as an archive
     * 
     * Example:
     * <code>
     *  require_once 'HTTP/Download/Archive.php';
     *  HTTP_Download_Archive::send(
     *      'myArchive.tgz',
     *      '/var/ftp/pub/mike',
     *      HTTP_DOWNLOAD_BZ2,
     *      '',
     *      '/var/ftp/pub'
     *  );
     * </code>
     *
     * @see         Archive_Tar::createModify()
     * @static
     * @access  public
     * @return  mixed   Returns true on success or PEAR_Error on failure.
     * @param   string  $name       name the sent archive should have
     * @param   mixed   $files      files/directories
     * @param   string  $type       archive type
     * @param   string  $add_path   path that should be prepended to the files
     * @param   string  $strip_path path that should be stripped from the files
     */
    function send($name, $files, $type = HTTP_DOWNLOAD_TGZ, $add_path = '', $strip_path = '')
    {
        $tmp = System::mktemp();
        
        switch ($type = strToUpper($type))
        {
            case HTTP_DOWNLOAD_TAR:
                include_once 'Archive/Tar.php';
                $arc = &new Archive_Tar($tmp);
                $content_type = 'x-tar';
            break;

            case HTTP_DOWNLOAD_TGZ:
                include_once 'Archive/Tar.php';
                $arc = &new Archive_Tar($tmp, 'gz');
                $content_type = 'x-gzip';
            break;

            case HTTP_DOWNLOAD_BZ2:
                include_once 'Archive/Tar.php';
                $arc = &new Archive_Tar($tmp, 'bz2');
                $content_type = 'x-bzip2';
            break;

            case HTTP_DOWNLOAD_ZIP:
                include_once 'Archive/Zip.php';
                $arc = &new Archive_Zip($tmp);
                $content_type = 'x-zip';
            break;
            
            default:
                return PEAR::raiseError(
                    'Archive type not supported: ' . $type,
                    HTTP_DOWNLOAD_E_INVALID_ARCHIVE_TYPE
                );
        }
        
        if ($type == HTTP_DOWNLOAD_ZIP) {
            $options = array(   'add_path' => $add_path, 
                                'remove_path' => $strip_path);
            if (!$arc->create($files, $options)) {
                return PEAR::raiseError('Archive creation failed.');
            }
        } else {
            if (!$e = $arc->createModify($files, $add_path, $strip_path)) {
                return PEAR::raiseError('Archive creation failed.');
            }
            if (PEAR::isError($e)) {
                return $e;
            }
        }
        unset($arc);
        
        $dl = &new HTTP_Download(array('file' => $tmp));
        $dl->setContentType('application/' . $content_type);
        $dl->setContentDisposition(HTTP_DOWNLOAD_ATTACHMENT, $name);
        return $dl->send();
    }
Example #16
0
 public static function printServerVar($vars)
 {
     foreach ((array) $vars as $name) {
         $name = strToUpper($name);
         if (isset($_SERVER[$name])) {
             echo $name . ': ' . $_SERVER[$name] . "\n";
         }
     }
 }
Example #17
0
 /**
  * Factory
  *
  * @param string $format MO or PO
  * @param string $file   path to GNU gettext file
  *
  * @static
  * @access  public
  * @return  object  Returns File_Gettext_PO or File_Gettext_MO on success
  *                  or PEAR_Error on failure.
  */
 function &factory($format, $file = '')
 {
     $format = strToUpper($format);
     if (!@(include_once 'File/Gettext/' . $format . '.php')) {
         return File_Gettext::raiseError($php_errormsg);
     }
     $class = 'File_Gettext_' . $format;
     $obref = new $class($file);
     return $obref;
 }
Example #18
0
function strToHex($string)
{
    $hex = '';
    for ($i = 0; $i < strlen($string); $i++) {
        $ord = ord($string[$i]);
        $hexCode = dechex($ord);
        $hex .= substr('0' . $hexCode, -2);
    }
    return strToUpper($hex);
}
 /**
  * Factory
  *
  * @static
  * @access  public
  * @return  object  Returns File_Gettext_PO or File_Gettext_MO on success 
  *                  or PEAR_Error on failure.
  * @param   string  $format MO or PO
  * @param   string  $file   path to GNU gettext file
  */
 static function factory($format, $file = '')
 {
     $format = strToUpper($format);
     $filename = dirname(__FILE__) . '/' . $format . '.php';
     if (is_file($filename) == false) {
         throw new Exception("Class file {$file} not found");
     }
     include_once $filename;
     $class = 'TGettext_' . $format;
     return new $class($file);
 }
Example #20
0
 function endingTopicsPosts($mark, $count)
 {
     $text = "";
     $count = intVal($count % 10);
     if ($count == 1) {
         $text = "_1";
     } elseif ($count > 1 && $count < 5) {
         $text = "_2_4";
     }
     return GetMessage("F_STAT_" . strToUpper($mark) . $text);
 }
Example #21
0
 /**
  * Return the type of the given object
  *
  * @param array request      the $_REQUEST object. Extract the 'on' param to get the object type
  * @param bool upper         if TRUE the return value is in UPPER CASE
  * @return string            a new object of $_REQUEST['on'] type
  * @access public
  */
 public static function getObjectType(array $request = array(), $upper = false)
 {
     if (!isset($request['on'])) {
         throw new Exception('Invalid request for parameter "on"');
     }
     $name = basename($request['on']);
     if ($upper) {
         return strToUpper($name);
     } else {
         return $name;
     }
 }
Example #22
0
function onBeforeUpload($Params)
{
    CModule::IncludeModule("iblock");
    $_SESSION['arUploadedPhotos'] = array();
    $arParams = $Params['arParams'];
    $savedData = CImageUploader::GetSavedData();
    $savedData['UPLOADING_START'] = "Y";
    CImageUploader::SetSavedData($savedData);
    if ($savedData["SECTION_ID"] <= 0) {
        $arParams["SECTION_ID"] = GetAlbumId(array('id' => $Params['packageFields']['photo_album_id'], 'name' => $Params['packageFields']['new_album_name'], 'arParams' => $arParams, '~arResult' => $Params['~arResult']));
        $savedData = CImageUploader::GetSavedData();
        $savedData["SECTION_ID"] = $arParams["SECTION_ID"];
    } else {
        $arParams["SECTION_ID"] = $savedData["SECTION_ID"];
    }
    // Check and create properties
    if (count($savedData['arError']) == 0) {
        $arPropertiesNeed = array();
        // Array of properties needed to create
        foreach ($arParams['converters'] as $key => $val) {
            if ($val['code'] == "real_picture" || $val['code'] == "thumbnail") {
                continue;
            }
            $db_res = CIBlock::GetProperties($arParams["IBLOCK_ID"], array(), array("CODE" => $val['code']));
            if (!($db_res && ($res = $db_res->Fetch()))) {
                $arPropertiesNeed[] = $val['code'];
            }
        }
        if (count($arPropertiesNeed) > 0) {
            $obProperty = new CIBlockProperty();
            foreach ($arPropertiesNeed as $key) {
                $res = $obProperty->Add(array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE" => "Y", "PROPERTY_TYPE" => "F", "MULTIPLE" => "N", "NAME" => strLen(GetMessage("P_" . strToUpper($key))) > 0 ? GetMessage("P_" . strToUpper($key)) : strToUpper($key), "CODE" => strToUpper($key), "FILE_TYPE" => "jpg, gif, bmp, png, jpeg"));
            }
        }
        // Check Public property
        $arPropertiesNeed = array();
        foreach (array("PUBLIC_ELEMENT", "APPROVE_ELEMENT") as $key) {
            $db_res = CIBlock::GetProperties($arParams["IBLOCK_ID"], array(), array("CODE" => $key));
            if (!$db_res || !($res = $db_res->Fetch())) {
                $arPropertiesNeed[] = $key;
            }
        }
        if (count($arPropertiesNeed) > 0) {
            $obProperty = new CIBlockProperty();
            foreach ($arPropertiesNeed as $key) {
                $res = $obProperty->Add(array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE" => "Y", "PROPERTY_TYPE" => "S", "MULTIPLE" => "N", "NAME" => strLen(GetMessage("P_" . $key)) > 0 ? GetMessage("P_" . $key) : $key, "DEFAULT_VALUE" => "N", "CODE" => $key));
            }
        }
    }
    CImageUploader::SetSavedData($savedData);
    return true;
}
Example #23
0
 function mb_convert_case($str, $mode, $enc = '')
 {
     switch ($mode) {
         case MB_CASE_LOWER:
             return strToLower($str);
         case MB_CASE_UPPER:
             return strToUpper($str);
         case MB_CASE_TITLE:
             return ucWords(strToLower($str));
         default:
             return $str;
     }
 }
Example #24
0
 protected function call($request, $path, $type = "post", $response_length = 1160)
 {
     $connection = @fsockopen($this->host, $this->port);
     $request = strToUpper($type) . " /{$this->akismet_version}/{$path} HTTP/1.1\r\n" . "Host: " . (!empty($this->api) ? $this->api . "." : null) . "{$this->host}\r\n" . "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n" . "Content-Length: " . strlen($request) . "\r\n" . "User-Agent: PHPAkismet/1.0\r\n" . "\r\n" . $request;
     $response = '';
     @fwrite($connection, $request);
     while (!feof($connection)) {
         $response .= @fgets($connection, $response_length);
     }
     $response = explode("\r\n\r\n", $response, 2);
     @fclose($connection);
     return $response[1];
 }
Example #25
0
 /**
  * Seit PHP 5.3 dürfen Objekte ausgeführt werden 
  * 
  * Diese Methode wird automatisch aufgerufen, wenn ein Klaseninstanz als
  * ausführbare Methode behandlet wird.
  * $log = new Logging();
  * $log(); -> führt die __invoke-Methode aus 
  */
 public function __invoke($message, $level = "INFO")
 {
     //Wenn die Datei noch nicht geöffnet ist, öffnen!
     if (!self::$fileHandle) {
         self::$fileHandle = @fopen(self::$logfile, 'a+');
     }
     //Entscheiden, ob beim aktuellen Log-Level protokolliert werden darf
     if (self::$logLevel == $level or $level == 'WARN') {
         //INFO oder WARNING protokollieren
         $string = strToUpper($level) . '::' . date("d.m.Y H:i:s", time()) . ' - ' . $message . ' - ' . $_SERVER["SCRIPT_FILENAME"] . "\r\n";
         //In die Datei schreiben
         fwrite(self::$fileHandle, $string);
     }
 }
Example #26
0
 public static function load($loc)
 {
     if (!file_exists('localization/locale_' . $loc . '.php')) {
         die('File for localization ' . strToUpper($loc) . ' not found.');
     } else {
         require 'localization/locale_' . $loc . '.php';
     }
     foreach ($lang as $k => $v) {
         self::${$k} = $v;
     }
     // *cough* .. reuse-hack
     self::$item['cat'][2] = [self::$item['cat'][2], self::$spell['weaponSubClass']];
     self::$item['cat'][2][1][14] .= ' (' . self::$item['cat'][2][0] . ')';
 }
 function perform()
 {
     if (!is_writable($this->config->get('data_dir'))) {
         $this->ae->add('error', $this->config->get('data_dir') . 'に書き込み権限がありません');
         return 'error';
     }
     $id = $this->af->get('id');
     $data_file = sprintf('%s%03d.cgi', $this->config->get('data_dir'), $id);
     if (!is_file($data_file)) {
         $this->ae->add('error', $data_file . 'が見つかりませんでした');
         return 'error';
     }
     if (!is_writable($data_file)) {
         $this->ae->add('error', $data_file . 'に書き込み権限がありません');
         return 'error';
     }
     $data =& $this->backend->getManager('Data');
     $data->load($data_file);
     $count = count($data->get('attr'));
     if ($count >= $this->config->get('element_limit')) {
         $this->ae->add('error', 'これ以上フォーム要素を追加できません');
         return 'form';
     }
     $var_types = array('text' => VAR_TYPE_STRING, 'textarea' => VAR_TYPE_STRING, 'select' => VAR_TYPE_STRING, 'radio' => VAR_TYPE_STRING, 'checkbox' => array(VAR_TYPE_STRING), 'file' => VAR_TYPE_FILE);
     $type_name = $this->af->get('type');
     if (!isset($var_types[$type_name])) {
         $this->ae->add('error', 'typeの値が正しくありません');
         return 'form';
     }
     $type = $var_types[$type_name];
     $form_type = constant('FORM_TYPE_' . strToUpper($type_name));
     $alist = range('a', 'z');
     $nlist = range(0, 9);
     $form_id = $type_name[0] . $nlist[mt_rand(0, 9)] . $alist[mt_rand(0, 25)] . $alist[mt_rand(0, 25)];
     $max = $type_name == 'textarea' ? '3000' : '300';
     $attr = array('id' => $form_id, 'type' => $type, 'form_type' => $form_type, 'type_name' => $type_name, 'name' => '未定義', 'required' => '1', 'custom' => '', 'regexp' => '', 'regexp_error' => '{form}を正しく入力して下さい', 'values' => '選択項目', 'default' => '', 'query' => '0', 'style' => 'ime-mode: auto;', 'min' => '0', 'max' => $max, 'width' => '50', 'height' => '5', 'example' => '', 'suffix' => '', 'group' => '0');
     $index = $this->af->get('index') - 1;
     // 最後に追加
     if ($index > $count - 1) {
         $this->af->set('index', $count + 2);
     }
     $array =& $data->getArray();
     $attr_list =& $array['attr'];
     array_splice($attr_list, $index, 0, array($attr));
     if (!$data->write()) {
         $this->ae->add('error', $data_file . 'に書き込めませんでした');
         return 'error';
     }
     return 'form';
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit(Request $request)
 {
     //Validate the Request
     $this->validate($request, ['id' => 'required|numeric', 'name' => 'max:255', 'email' => 'email|max:255|unique:users,email', 'phone' => 'numeric']);
     $ut = User::find($request->id);
     $ut->name = $request->input('name', $ut->name);
     $ut->email = $request->input('email', $ut->email);
     $ut->phone = $request->input('phone', $ut->phone);
     $ut->address = $request->input('address', $ut->address);
     $ut->status = strToUpper($request->input('status', $ut->status));
     $ut->save();
     \Session::flash('flash_message', 'Updated Successfully!');
     \Session::flash('flash_message_level', 'success');
     return Redirect::to('admin/users');
 }
Example #29
0
 function Log($object, $action, $id, $description = "", $title = "")
 {
     if (COption::GetOptionString("forum", "LOGS", "Q") <= "A") {
         return false;
     }
     $arTypesTitle = array("FORUM_MESSAGE_APPROVE" => GetMessage("FORUM_MESSAGE_APPROVE"), "FORUM_MESSAGE_UNAPPROVE" => GetMessage("FORUM_MESSAGE_UNAPPROVE"), "FORUM_MESSAGE_MOVE" => GetMessage("FORUM_MESSAGE_MOVE"), "FORUM_MESSAGE_EDIT" => GetMessage("FORUM_MESSAGE_EDIT"), "FORUM_MESSAGE_DELETE" => GetMessage("FORUM_MESSAGE_DELETE"), "FORUM_MESSAGE_SPAM" => GetMessage("FORUM_MESSAGE_SPAM"), "FORUM_TOPIC_APPROVE" => GetMessage("FORUM_TOPIC_APPROVE"), "FORUM_TOPIC_UNAPPROVE" => GetMessage("FORUM_TOPIC_UNAPPROVE"), "FORUM_TOPIC_STICK" => GetMessage("FORUM_TOPIC_STICK"), "FORUM_TOPIC_UNSTICK" => GetMessage("FORUM_TOPIC_UNSTICK"), "FORUM_TOPIC_OPEN" => GetMessage("FORUM_TOPIC_OPEN"), "FORUM_TOPIC_CLOSE" => GetMessage("FORUM_TOPIC_CLOSE"), "FORUM_TOPIC_MOVE" => GetMessage("FORUM_TOPIC_MOVE"), "FORUM_TOPIC_EDIT" => GetMessage("FORUM_TOPIC_EDIT"), "FORUM_TOPIC_DELETE" => GetMessage("FORUM_TOPIC_DELETE"), "FORUM_TOPIC_SPAM" => GetMessage("FORUM_TOPIC_SPAM"), "FORUM_FORUM_EDIT" => GetMessage("FORUM_FORUM_EDIT"), "FORUM_FORUM_DELETE" => GetMessage("FORUM_FORUM_DELETE"));
     $object = strToUpper($object);
     $action = strToUpper($action);
     $type = "FORUM_" . $object . "_" . $action;
     $title = trim($title);
     if (empty($title)) {
         $title = $arTypesTitle[$type];
     }
     $description = trim($description);
     CEventLog::Log("NOTICE", $type, "forum", $id, $description);
 }
Example #30
0
 function get_response($request, $path, $type = "post", $response_length = 1160)
 {
     $this->_connect();
     if ($this->con && !$this->is_error('AKISMET_SERVER_NOT_FOUND')) {
         $request = strToUpper($type) . " /{$this->akismet_version}/{$path} HTTP/1.0\r\n" . "Host: " . (!empty($this->api_key) ? $this->api_key . "." : null) . "{$this->akismet_server}\r\n" . "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n" . "Content-Length: " . strlen($request) . "\r\n" . "User-Agent: Akismet CodeIgniter Library\r\n" . "\r\n" . $request;
         $response = "";
         @fwrite($this->con, $request);
         while (!feof($this->con)) {
             $response .= @fgets($this->con, $response_length);
         }
         $response = explode("\r\n\r\n", $response, 2);
         return $response[1];
     } else {
         $this->set_error('AKISMET_RESPONSE_FAILED', "The response could not be retrieved.");
     }
     $this->_disconnect();
 }