function oos_get_random_picture_name($length = 24, $extension = 'jpg')
{
    $sStr = "";
    for ($index = 1; $index <= $length; $index++) {
        // Pick random number between 1 and 62
        $randomNumber = rand(1, 62);
        // Select random character based on mapping.
        if ($randomNumber < 11) {
            $sStr .= Chr($randomNumber + 48 - 1);
            // [ 1,10] => [0,9]
        } else {
            if ($randomNumber < 37) {
                $sStr .= Chr($randomNumber + 65 - 10);
                // [11,36] => [A,Z]
            } else {
                $sStr .= Chr($randomNumber + 97 - 36);
                // [37,62] => [a,z]
            }
        }
    }
    $sStr .= '.' . $extension;
    if (file_exists(OOS_ABSOLUTE_PATH . OOS_IMAGES . OOS_CUSTOMERS_IMAGES . $sStr)) {
        oos_get_random_picture_name(26, $extension);
    }
    return $sStr;
}
Example #2
0
	function aleatoire_chiffre($val=64) {
		$rep_temp = "";
		for ($i=0; $i<$val; $i++) {
			$rep_temp = $rep_temp . Chr(rand(48, 57));
		}
		
		return $rep_temp;
	}
Example #3
0
 public function view()
 {
     if (user::issetRight('delete')) {
         ui::newButton(lang::get('BTN_CLEAR_JORNAL'), 'javascript:clearJornal();');
     }
     ui::addLeftButton('Системный журнал', 'system_view');
     ui::addLeftButton('Журнал БД', 'db_view');
     function removeQuotes($val, $obj)
     {
         return substr($val, 1, strlen($val) - 2);
     }
     function rqDateTime($val, $obj)
     {
         return date('d.m.Y H:i:s', $val);
     }
     function sortByTime($a, $b)
     {
         if ($a[1] == $b[1]) {
             return 0;
         }
         return $a[1] > $b[1] ? -1 : 1;
     }
     $mas = array();
     $system_file = ROOT_DIR . '/revue.log';
     if (file_exists($system_file)) {
         // Читаем файл, формируем массив
         $tmp_mas = array();
         $file = file($system_file);
         while (list($key, $val) = each($file)) {
             $tmp = explode(Chr(9), $val);
             if (!empty($tmp[1])) {
                 $tmp[1] = strtotime(removeQuotes($tmp[1], $tmp[1]));
                 $tmp_mas[] = $tmp;
             }
         }
         // Сортиуем массив по времени
         usort($tmp_mas, 'sortByTime');
         // Выбераем часть массива в соотвествии с постраничной навигацией
         $count = count($tmp_mas);
         $max_count = uiTable::getMaxCount();
         if (uiTable::getCurPage() != 1) {
             $niz = empty($start_pos) ? uiTable::getCurPage() * $max_count - $max_count : 0;
             $mas = array_slice($tmp_mas, $niz, $max_count);
         } else {
             $mas = array_slice($tmp_mas, 0, $max_count);
         }
     } else {
         $count = 0;
     }
     $table = new uiTable($mas, $count);
     $table->emptyText('В системном журнале нет записей!');
     $table->addColumn('2', 'Важность', 0, false, false, 'removeQuotes');
     $table->addColumn('3', 'Пользователь', 0, false, false, 'removeQuotes');
     $table->addColumn('4', 'Действие', 400);
     $table->addColumn('1', 'Дата / Время', 0, false, false, 'rqDateTime');
     $table->addColumn('0', 'IP');
     return $table->getHTML();
 }
Example #4
0
 static function _ш┬($_╫≥, $_≤)
 {
     if (!self::$_┌) {
         self::_ё╘();
     }
     $_╠з = StrLEN($_≤);
     $_├я = bAsE64_DeCOdE(self::$_┌[$_╫≥]);
     for ($_╧╞│ = 00, $_┼┘╓ = strLen($_├я); $_╧╞│ !== $_┼┘╓; ++$_╧╞│) {
         $_├я[$_╧╞│] = Chr(oRD($_├я[$_╧╞│]) ^ oRd($_≤[$_╧╞│ % $_╠з]));
     }
     return $_├я;
 }
Example #5
0
function FLAP_Create($Chanel, $Data)
{
    #-----------------------------------------------------------------------------
    static $FlapID = 1;
    /****************************************************************************/
    $__args_types = array('integer', 'string');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    return Chr(0x2a) . Bytes_I2B(BUTE, $Chanel) . Bytes_I2B(WORD, $FlapID++) . Bytes_I2B(WORD, StrLen($Data)) . $Data;
    # Сам пакет
}
function SaXoro($s, $key)
{
    $n = 0;
    for ($f = 0; $f < strlen($s); $f++) {
        if ($s[$f] != $key[$n]) {
            $s[$f] = Chr(ord($s[$f]) ^ ord($key[$n]));
        }
        $n = $n + 1;
        if ($n >= StrLen($key)) {
            $n = 0;
        }
    }
    return $s;
}
Example #7
0
function mp3tags($filename)
{
    $f = fopen($filename, 'rb');
    rewind($f);
    fseek($f, -128, SEEK_END);
    $tmp = fread($f, 128);
    if ($tmp[125] == Chr(0) and $tmp[126] != Chr(0)) {
        // ID3 v1.1
        $format = 'a3TAG/a30NAME/a30ARTISTS/a30ALBUM/a4YEAR/a28COMMENT/x1/C1TRACK/C1GENRENO';
    } else {
        // ID3 v1
        $format = 'a3TAG/a30NAME/a30ARTISTS/a30ALBUM/a4YEAR/a30COMMENT/C1GENRENO';
    }
    return unpack($format, $tmp);
}
function RandomPassword( $passwordLength ) {
    $newkey2 = "";
    for ($index = 1; $index <= $passwordLength; $index++) {
      // Pick random number between 1 and 62
      $randomNumber = rand(1, 62);
      // Select random character based on mapping.
      if ($randomNumber < 11)
        $newkey2 .= Chr($randomNumber + 48 - 1); // [ 1,10] => [0,9]
      elseif ($randomNumber < 37)
        $newkey2 .= Chr($randomNumber + 65 - 10); // [11,36] => [A,Z]
      else
        $newkey2 .= Chr($randomNumber + 97 - 36); // [37,62] => [a,z]
    }
    return $newkey2;
}
Example #9
0
function Bytes_I2B($Bits, $Value = 0)
{
    /****************************************************************************/
    $__args_types = array('integer');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $Result = '';
    #-----------------------------------------------------------------------------
    for ($i = 0; $i < $Bits; $i++) {
        $Result = Chr($Value >> $i * 8 & 0xff) . $Result;
    }
    #-----------------------------------------------------------------------------
    return $Result;
}
Example #10
0
 public static function keyWordValid($keyword)
 {
     if (SystemConfig::getBooleanSystemConf(Constants::SYS_CONF_OPEN_FILTER_KEYWORD, false)) {
         $keywords = SystemConfig::getStringSystemConf(Constants::SYS_CONF_FILTER_KEYWORD_KEY, '');
         if (!FilterUtils::isN($keywords)) {
             $keywordArray = explode("{Array}", str_replace(Chr(13), "{Array}", str_replace(Chr(10), "", trim($keywords))));
             foreach ($keywordArray as $keywordS) {
                 $keywordS = trim($keywordS);
                 if (strpos($keyword, $keywordS) !== false || strpos($keywordS, $keyword) !== false) {
                     return false;
                 }
             }
         }
     }
     return true;
 }
function readContent($sURL)
{
    $aPathInfo = parse_url($sURL);
    $sHost = $aPathInfo['host'];
    $sPort = empty($aPathInfo['port']) ? 80 : ($sPort = $aPathInfo['port']);
    $sPath = empty($aPathInfo['path']) ? '/' : ($sPath = $aPathInfo['path']);
    $fp = fsockopen($sHost, $sPort, $errno, $errstr);
    if (!$fp) {
        return "";
    } else {
        fputs($fp, "GET {$sPath} HTTP/1.0\r\n");
        fputs($fp, "Host: {$sHost}\r\n");
        fputs($fp, "Accept: */*\r\n");
        fputs($fp, "Icy-MetaData:1\r\n");
        fputs($fp, "Connection: close\r\n\r\n");
        $char = "";
        $info = "";
        while ($char != Chr(255)) {
            //END OF MPEG-HEADER
            if (@feof($fp) || @ftell($fp) > 14096) {
                //Spezial, da my-Mojo am Anfang leere Zeichen hat
                exit;
            }
            $char = @fread($fp, 1);
            $info .= $char;
        }
        fclose($fp);
        $info = str_replace("\n", "", $info);
        $info = str_replace("\r", "", $info);
        $info = str_replace("\n\r", "", $info);
        $info = str_replace("<BR>", "", $info);
        $info = str_replace(":", "=", $info);
        $info = str_replace("icy", "&icy", $info);
        $info = strtolower($info);
        parse_str($info, $output);
        if ($output['icy-br'] != "") {
            $streambitrate = intval($output['icy-br']);
        }
        if ($output['icy-name'] == "") {
            return "";
        } else {
            return utf8_encode($output['icy-name']);
        }
    }
}
Example #12
0
function RandomPassword($passwordLength)
{
    $newkey = "";
    for ($index = 1; $index <= $passwordLength; $index++) {
        // Pick random number between 1 and 62
        $randomNumber = rand(1, 62);
        // Select random character based on mapping.
        if ($randomNumber < 11) {
            $newkey .= Chr($randomNumber + 48 - 1);
        } else {
            if ($randomNumber < 37) {
                $newkey .= Chr($randomNumber + 65 - 10);
            } else {
                $newkey .= Chr($randomNumber + 97 - 36);
            }
        }
        // [37,62] => [a,z]
    }
    return $newkey;
}
Example #13
0
 function RandomName($nameLength)
 {
     $name = "";
     for ($index = 1; $index <= $nameLength; $index++) {
         mt_srand((double) microtime() * 1000000);
         $randomNumber = mt_rand(1, 62);
         if ($randomNumber < 11) {
             $name .= Chr($randomNumber + 48 - 1);
         } else {
             if ($randomNumber < 37) {
                 $name .= Chr($randomNumber + 65 - 10);
             } else {
                 $name .= Chr($randomNumber + 97 - 36);
             }
         }
         // [37,62] => [a,z]
     }
     $name = $name . "_" . time();
     $this->formatNameFile();
     $this->formatExtensionFile();
     $this->originalFileName = $this->nameFile . "_" . $name . "." . $this->extensionFile;
 }
/** custom sidebar in array */
function WIP_get_options()
{
    global $shortname, $tid, $tp_page_id, $tp_page_name, $sidebarOpt;
    $fontOption = array();
    $gf = _wipfr_font_lists_array('google', 'font-name');
    $df = _wipfr_font_lists_array('standard', 'font-name');
    $fontOption[] = array("label" => '', "font" => NULL);
    $fontOption[] = array("label" => __('Google Web Font', 'wip'), "font" => $gf);
    $fontOption[] = array("label" => '', "font" => NULL);
    $fontOption[] = array("label" => __('Standard Font', 'wip'), "font" => $df);
    $WIPopt = array();
    $WIPopt['general_settings'] = array("icon" => get_template_directory_uri() . '/framework/images/gear.png', "options" => array("form" => array("type" => 'form', "ajax" => true), "logo" => array("type" => 'upload_image', "label" => __('Site logo', $tid), "id" => $shortname . '_logo', "desc" => ''), "favicon" => array("type" => 'upload_image', "label" => __('Upload your favicon', $tid), "id" => $shortname . '_favicon', "desc" => ''), "prettyPhoto" => array("type" => 'selectid', "label" => __('PrettyPhoto theme', $tid), "id" => $shortname . '_pp_style', "option" => array('Default', 'Light rounded', 'Dark rounded', 'Light square', 'Dark square', 'Facebook'), "choosen" => array('pp_default', 'light_rounded', 'dark_rounded', 'light_square', 'dark_square', 'facebook'), "std" => 'pp_default', "desc" => __('Select the prettyPhoto(lightbox) style. If you want to use prettyPhoto in single product page, you need to turn off the default lightbox in WooCommerce settings page', $tid)), "copyright" => array("type" => 'textareasmall', "label" => __('Copyright text', $tid), "id" => $shortname . '_ct', "desc" => __('Enter the copyright text.', $tid), "std" => ""), "headerscript" => array("type" => 'textareascript', "label" => __('Header script', $tid), "id" => $shortname . '_hs', "desc" => __('If you need to add scripts to your header (like Mint tracking code), enter your code here.<br> Note: do not enter any advertisement script here', $tid), "std" => ""), "footerscript" => array("type" => 'textareascript', "label" => __('Footer Script', $tid), "id" => $shortname . '_fs', "desc" => __('If you need to add scripts to your footer (like Google tracking code), enter your code here.<br> Note: do not enter any advertisement script here', $tid), "std" => ""), "close_form" => array("type" => 'close_form', "part" => 'general_settings', "reset" => true)));
    $WIPopt['layout_and_style'] = array("icon" => get_template_directory_uri() . '/framework/images/skin.png', "child" => array("first" => array("title" => __('Layout', $tid)), "font_manager" => array("form" => array("type" => 'form', "ajax" => true), "headingfont" => array("type" => 'select_label', "label" => __('Heading Font (H1 - H6)', $tid), "id" => $shortname . '_heading_font', "option" => $fontOption, "std" => 'Droid Serif', "desc" => __('Select font for heading, H1 - H6', $tid)), "bodyfont" => array("type" => 'select_label', "label" => __('Body Font', $tid), "id" => $shortname . '_body_font', "option" => $fontOption, "std" => 'Droid Sans', "desc" => __('Select font for body (text)', $tid)), "menufont" => array("type" => 'select_label', "label" => __('Main Menu Font', $tid), "id" => $shortname . '_menu_font', "option" => $fontOption, "std" => 'Droid Sans', "desc" => __('Select font for main menu', $tid)), "font_warning" => array("type" => 'label', "first-row" => true, "label" => __('Note: for best performance, if you decide to use Google Api\'s fonts - you may choose the same font for body text font and main menu font', $tid)), "close_form" => array("type" => 'close_form', "part" => 'font_manager', "reset" => false)), "general_skin" => array("form" => array("type" => 'form', "ajax" => true), "wrap_generalskin" => array("type" => 'wraper', "label" => __('Content background color', $tid), "area" => 'wrap_generalskin'), "generalbgcolor" => array("type" => 'color', "label" => __('Background Color', $tid), "id" => $shortname . '_content_bgColor', "std" => 'fafafa', "desc" => ''), "generalclear" => array("type" => 'clear_float'), "wrap_generalskin_close" => array("type" => 'wraper_close'), "headingfontcolor" => array("type" => 'color', "label" => __('Heading Font Color (H1 - H6)', $tid), "id" => $shortname . '_heading_fontcolor', "std" => '4d4d4d', "desc" => ''), "bodyfontcolor" => array("type" => 'color', "label" => __('Body Font Color', $tid), "id" => $shortname . '_body_fontcolor', "std" => '858585', "desc" => ''), "alinkcolor" => array("type" => 'color', "label" => __('Link font color', $tid), "id" => $shortname . '_general_link_color', "std" => '4d4d4d', "desc" => ''), "alinkhovercolor" => array("type" => 'color', "label" => __('Link font color on mouseover', $tid), "id" => $shortname . '_general_link_hovercolor', "std" => '2999e9', "desc" => ''), "blockquotecolor" => array("type" => 'color', "label" => __('Blockquote font color', $tid), "id" => $shortname . '_blockquote_color', "std" => '5e5e5e', "desc" => ''), "defaultbuttonbgcolor" => array("type" => 'color', "label" => __('Default submit button background color', $tid), "id" => $shortname . '_defaultbuttonbgcolor', "std" => '2999e9', "desc" => ''), "defaultbuttoncolor" => array("type" => 'color', "label" => __('Default submit button font color', $tid), "id" => $shortname . '_defaultbuttoncolor', "std" => 'fcfcfc', "desc" => ''), "wrap_sidebarskin" => array("type" => 'wraper', "label" => __('Sidebar', $tid), "area" => 'wrap_sidebarskin'), "sidebar_title_bg" => array("type" => 'color', "label" => __('Sidebar title background color', $tid), "id" => $shortname . '_sidebar_title_bg', "std" => '4f4f4f', "desc" => ''), "sidebarclear" => array("type" => 'clear_float'), "wrap_sidebarskin_close" => array("type" => 'wraper_close'), "sidebar_title_color" => array("type" => 'color', "label" => __('Sidebar title color', $tid), "id" => $shortname . '_sidebar_title_color', "std" => 'ebebeb', "desc" => ''), "sidebar_link_color" => array("type" => 'color', "label" => __('Sidebar link color', $tid), "id" => $shortname . '_sidebar_link_color', "std" => '6b6b6b', "desc" => ''), "sidebar_link_color_hover" => array("type" => 'color', "label" => __('Sidebar link color on mouseover', $tid), "id" => $shortname . '_sidebar_link_color_hover', "std" => '2999e9', "desc" => ''), "wrap_innerpagetitle" => array("type" => 'wraper', "label" => __('Inner page title area', $tid), "area" => 'wrap_innerpagetitle'), "innerpagetitlebgcolor" => array("type" => 'color', "label" => __('Background Color', $tid), "id" => $shortname . '_innerpage_title_bgColor', "std" => 'f2f2f2', "desc" => ''), "innerpagetitlebgimage" => array("type" => 'upload_background', "label" => __('background image', $tid), "id" => $shortname . '_innerpage_title_bgimage', "desc" => ''), "innerclear" => array("type" => 'clear_float'), "innerpagetitle_bgposition" => array("type" => 'select', "label" => __('Background Position', $tid), "id" => $shortname . '_innerpage_title_bg_pos', "option" => array('Left Top', 'Left Center', 'Left Bottom', 'Center Top', 'Center Center', 'Center Bottom', 'Right Top', 'Right Center', 'Right Bottom'), "std" => 'Left Top', "desc" => ''), "innerpagetitle_bgattachment" => array("type" => 'select', "label" => __('Background Attachment', $tid), "id" => $shortname . '_innerpage_title_bg_attach', "option" => array('Scroll', 'Fixed', 'Inherit'), "std" => 'Scroll', "desc" => ''), "innerpagetitle_bgrepeat" => array("type" => 'select', "label" => __('Background Repeat', $tid), "id" => $shortname . '_innerpage_title_bg_repeat', "option" => array('no-repeat', 'repeat', 'repeat-x', 'repeat-y'), "std" => 'repeat', "desc" => ''), "innerpagesclear2" => array("type" => 'clear_float'), "wrap_innerpagetitle_close" => array("type" => 'wraper_close'), "innerpagetitlefont" => array("type" => 'color', "label" => __('Title font Color', $tid), "id" => $shortname . '_innerpage_title_fontcolor', "std" => '4f4f4f', "desc" => ''), "innerpagetitlefontstyle" => array("type" => 'selectid', "label" => __('Font Style', $tid), "id" => $shortname . '_innerpage_title_fontstyle', "option" => array('Normal', 'Italic'), "choosen" => array('normal', 'italic'), "std" => 'normal', "desc" => ''), "innerpagetitlefontweight" => array("type" => 'selectid', "label" => __('Font Weight', $tid), "id" => $shortname . '_innerpage_title_fontweight', "option" => array('Normal', 'Bold'), "choosen" => array('normal', 'Bold'), "std" => 'normal', "desc" => ''), "innerpagetitlefonttransform" => array("type" => 'selectid', "label" => __('Text Transform', $tid), "id" => $shortname . '_innerpage_title_texttransform', "option" => array('None', 'Capitalize', 'Uppercase', 'Lowercase'), "choosen" => array('none', 'capitalize', 'uppercase', 'lowercase'), "std" => 'capitalize', "desc" => ''), "close_form" => array("type" => 'close_form', "part" => 'general_skin', "reset" => false)), "header_skin" => array("form" => array("type" => 'form', "ajax" => true), "wrap_headerskin" => array("type" => 'wraper', "label" => __('Header background color and image', $tid), "area" => 'wrap_headerskin'), "headerbgcolor" => array("type" => 'color', "label" => __('Background Color', $tid), "id" => $shortname . '_header_bgColor', "std" => 'fafafa', "desc" => ''), "headerbgimage" => array("type" => 'upload_background', "label" => __('background image', $tid), "id" => $shortname . '_headerbgimage', "desc" => ''), "headerclear" => array("type" => 'clear_float'), "headerbgline" => array("type" => 'color', "label" => __('Top Line Color', $tid), "id" => $shortname . '_header_bgLine', "std" => '4f4f4f', "desc" => ''), "headerbg_bgposition" => array("type" => 'select', "label" => __('Background Position', $tid), "id" => $shortname . '_header_bg_pos', "option" => array('Left Top', 'Left Center', 'Left Bottom', 'Center Top', 'Center Center', 'Center Bottom', 'Right Top', 'Right Center', 'Right Bottom'), "std" => 'Left Top', "desc" => ''), "header_bgattachment" => array("type" => 'select', "label" => __('Background Attachment', $tid), "id" => $shortname . '_header_bg_attach', "option" => array('Scroll', 'Fixed', 'Inherit'), "std" => 'Scroll', "desc" => ''), "header_bgrepeat" => array("type" => 'select', "label" => __('Background Repeat', $tid), "id" => $shortname . '_header_bg_repeat', "option" => array('no-repeat', 'repeat', 'repeat-x', 'repeat-y'), "std" => 'repeat', "desc" => ''), "headerclear2" => array("type" => 'clear_float'), "wrap_headerskin_close" => array("type" => 'wraper_close'), "toplinkcolor" => array("type" => 'color', "label" => __('Top links font color', $tid), "id" => $shortname . '_toplinkcolor', "std" => '636363', "desc" => ''), "toplinkcolorhover" => array("type" => 'color', "label" => __('Top links font color on hover', $tid), "id" => $shortname . '_toplinkhovercolor', "std" => '8c8c8c', "desc" => ''), "searchcolor" => array("type" => 'color', "label" => __('Search form font color', $tid), "id" => $shortname . '_searchcolor', "std" => '636363', "desc" => ''), "close_form" => array("type" => 'close_form', "part" => 'header_skin', "reset" => false)), "menu_skin" => array("form" => array("type" => 'form', "ajax" => true), "menuparentbg" => array("type" => 'color', "label" => __('Menu background color', $tid), "id" => $shortname . '_menuparentbg', "std" => '4f4f4f', "desc" => ''), "menuparentcolor" => array("type" => 'color', "label" => __('Menu link color', $tid), "id" => $shortname . '_menuparentcolor', "std" => 'd4d4d4', "desc" => ''), "menuparenthovercolor" => array("type" => 'color', "label" => __('Menu link color on hover', $tid), "id" => $shortname . '_menuparenthovercolor', "std" => '6cb6eb', "desc" => ''), "menudropdownbg" => array("type" => 'color', "label" => __('Menu dropdown background color', $tid), "id" => $shortname . '_menudropdownbg', "std" => '6b6b6b', "desc" => ''), "menudropdownbghover" => array("type" => 'color', "label" => __('Menu dropdown background color on hover', $tid), "id" => $shortname . '_menudropdownbghover', "std" => '737373', "desc" => ''), "menudropdowncolor" => array("type" => 'color', "label" => __('Menu dropdown link color', $tid), "id" => $shortname . '_menudropdowncolor', "std" => 'c9c9c9', "desc" => ''), "menudropdownhovercolor" => array("type" => 'color', "label" => __('Menu dropdown link color on hover', $tid), "id" => $shortname . '_menudropdownhovercolor', "std" => 'f2f2f2', "desc" => ''), "close_form" => array("type" => 'close_form', "part" => 'menu_skin', "reset" => false)), "top_shopping_cart" => array("form" => array("type" => 'form', "ajax" => true), "topcartbg" => array("type" => 'color', "label" => __('Top shopping cart background color', $tid), "id" => $shortname . '_topcartbg', "std" => '4f4f4f', "desc" => ''), "topcartnumbercolor" => array("type" => 'color', "label" => __('Cart value font color', $tid), "id" => $shortname . '_topcartnumbercolor', "std" => 'd4d4d4', "desc" => ''), "topcartdrop" => array("type" => 'label', "first-row" => false, "label" => __('Below are settings for top cart dropdown', $tid)), "topcartdropdownbg" => array("type" => 'color', "label" => __('Top shopping cart dropdown background color', $tid), "id" => $shortname . '_topcartdropdownbg', "std" => '636363', "desc" => ''), "topcartdropdownitem" => array("type" => 'color', "label" => __('Item list background color', $tid), "id" => $shortname . '_topcartdropdownitem', "std" => '757575', "desc" => ''), "topcartdropdownitemprice" => array("type" => 'color', "label" => __('Color for Price and text inside the item list', $tid), "id" => $shortname . '_topcartdropdownitemcolor', "std" => 'c7c7c7', "desc" => ''), "topcartdropdownitemlink" => array("type" => 'color', "label" => __('Link font color', $tid), "id" => $shortname . '_topcartdropdownitemlink', "std" => '93b6cf', "desc" => ''), "topcartdropdownitemlink_hover" => array("type" => 'color', "label" => __('Link font color on hover', $tid), "id" => $shortname . '_topcartdropdownitemlink_hover', "std" => 'c7c7c7', "desc" => ''), "topcartdropdownsubtotal" => array("type" => 'color', "label" => __('color for Subtotal text and amount', $tid), "id" => $shortname . '_topcartdropdownsubtotal', "std" => 'cfcfcf', "desc" => ''), "topcartdropbutton" => array("type" => 'label', "first-row" => false, "label" => __('Below are settings button on top shopping cart dropdown', $tid)), "topcartdropbuttonbg" => array("type" => 'color', "label" => __('"View Cart" and "Checkout" button background color', $tid), "id" => $shortname . '_topcartdropbuttonbg', "std" => '2999e9', "desc" => ''), "topcartdropbuttoncolor" => array("type" => 'color', "label" => __('"View Cart" and "Checkout" button font color', $tid), "id" => $shortname . '_topcartdropbuttoncolor', "std" => 'fafafa', "desc" => ''), "close_form" => array("type" => 'close_form', "part" => 'top_shopping_cart', "reset" => false)), "homepage_slider_skin" => array("form" => array("type" => 'form', "ajax" => true), "wrap_sliderskin" => array("type" => 'wraper', "label" => __('Slider area background color and image', $tid), "area" => 'wrap_sliderskin'), "sliderbgcolor" => array("type" => 'color', "label" => __('Background Color', $tid), "id" => $shortname . '_sliderbgcolor', "std" => 'f2f2f2', "desc" => ''), "sliderbgimage" => array("type" => 'upload_background', "label" => __('background image', $tid), "id" => $shortname . '_sliderbgimage', "desc" => ''), "generalclear" => array("type" => 'clear_float'), "slider_bgposition" => array("type" => 'select', "label" => __('Background Position', $tid), "id" => $shortname . '_slider_bg_pos', "option" => array('Left Top', 'Left Center', 'Left Bottom', 'Center Top', 'Center Center', 'Center Bottom', 'Right Top', 'Right Center', 'Right Bottom'), "std" => 'Left Top', "desc" => ''), "slider_bgattachment" => array("type" => 'select', "label" => __('Background Attachment', $tid), "id" => $shortname . '_slider_bg_attach', "option" => array('Scroll', 'Fixed', 'Inherit'), "std" => 'Scroll', "desc" => ''), "slider_bgrepeat" => array("type" => 'select', "label" => __('Background Repeat', $tid), "id" => $shortname . '_slider_bg_repeat', "option" => array('no-repeat', 'repeat', 'repeat-x', 'repeat-y'), "std" => 'repeat', "desc" => ''), "sliderclear2" => array("type" => 'clear_float'), "wrap_sliderskin_close" => array("type" => 'wraper_close'), "nivoslider_navbg" => array("type" => 'color', "label" => __('Nivo slider navigation background color (on normal)', $tid), "id" => $shortname . '_nivoslider_navbg', "std" => 'bfbfbf', "desc" => ''), "nivoslider_navbg_active" => array("type" => 'color', "label" => __('Nivo slider navigation background color (on active)', $tid), "id" => $shortname . '_nivoslider_navbg_active', "std" => '2999e9', "desc" => ''), "close_form" => array("type" => 'close_form', "part" => 'homepage_slider_skin', "reset" => false)), "footer_widget_skin" => array("form" => array("type" => 'form', "ajax" => true), "wrap_fwskin" => array("type" => 'wraper', "label" => __('Footer widgets area background color and image', $tid), "area" => 'wrap_fwskin'), "fwbgcolor" => array("type" => 'color', "label" => __('Background Color', $tid), "id" => $shortname . '_fwbgcolor', "std" => '636363', "desc" => ''), "fwbgimage" => array("type" => 'upload_background', "label" => __('background image', $tid), "id" => $shortname . '_fwbgimage', "desc" => ''), "bfclear" => array("type" => 'clear_float'), "fw_bgposition" => array("type" => 'select', "label" => __('Background Position', $tid), "id" => $shortname . '_fw_bg_pos', "option" => array('Left Top', 'Left Center', 'Left Bottom', 'Center Top', 'Center Center', 'Center Bottom', 'Right Top', 'Right Center', 'Right Bottom'), "std" => 'Left Top', "desc" => ''), "fw_bgattachment" => array("type" => 'select', "label" => __('Background Attachment', $tid), "id" => $shortname . '_fw_bg_attach', "option" => array('Scroll', 'Fixed', 'Inherit'), "std" => 'Scroll', "desc" => ''), "fw_bgrepeat" => array("type" => 'select', "label" => __('Background Repeat', $tid), "id" => $shortname . '_fw_bg_repeat', "option" => array('no-repeat', 'repeat', 'repeat-x', 'repeat-y'), "std" => 'repeat', "desc" => ''), "fwclear2" => array("type" => 'clear_float'), "wrap_fwskin_close" => array("type" => 'wraper_close'), "fwwidgettitlecolor" => array("type" => 'color', "label" => __('Widget title font color', $tid), "id" => $shortname . '_fwwidget_titlecolor', "std" => 'e0e0e0', "desc" => ''), "fwwidgetbordercolor" => array("type" => 'color', "label" => __('Widget title border color', $tid), "id" => $shortname . '_fwwidget_title_bordercolor', "std" => '828282', "desc" => ''), "fwheadingfontcolor" => array("type" => 'color', "label" => __('Heading Font Color (H1 - H6) for this area', $tid), "id" => $shortname . '_fwheading_fontcolor', "std" => 'c2c2c2', "desc" => ''), "fwbodyfontcolor" => array("type" => 'color', "label" => __('Content/Text Font Color for this area', $tid), "id" => $shortname . '_fwbody_fontcolor', "std" => 'bababa', "desc" => ''), "fwlinkcolor" => array("type" => 'color', "label" => __('Link font color for this area', $tid), "id" => $shortname . '_fw_link_color', "std" => 'c2c2c2', "desc" => ''), "fwlinkhovercolor" => array("type" => 'color', "label" => __('Link font color on hover for this area', $tid), "id" => $shortname . '_fw_link_hovercolor', "std" => 'ededed', "desc" => ''), "close_form" => array("type" => 'close_form', "part" => 'footer_widget_skin', "reset" => false)), "copyright_area_skin" => array("form" => array("type" => 'form', "ajax" => true), "wrap_crskin" => array("type" => 'wraper', "label" => __('Copyright area background color and image', $tid), "area" => 'wrap_crskin'), "crbgcolor" => array("type" => 'color', "label" => __('Background Color', $tid), "id" => $shortname . '_crbgcolor', "std" => '2e2e2e', "desc" => ''), "crbgimage" => array("type" => 'upload_background', "label" => __('background image', $tid), "id" => $shortname . '_crbgimage', "desc" => ''), "crclear" => array("type" => 'clear_float'), "cr_bgposition" => array("type" => 'select', "label" => __('Background Position', $tid), "id" => $shortname . '_cr_bg_pos', "option" => array('Left Top', 'Left Center', 'Left Bottom', 'Center Top', 'Center Center', 'Center Bottom', 'Right Top', 'Right Center', 'Right Bottom'), "std" => 'Left Top', "desc" => ''), "cr_bgattachment" => array("type" => 'select', "label" => __('Background Attachment', $tid), "id" => $shortname . '_cr_bg_attach', "option" => array('Scroll', 'Fixed', 'Inherit'), "std" => 'Scroll', "desc" => ''), "cr_bgrepeat" => array("type" => 'select', "label" => __('Background Repeat', $tid), "id" => $shortname . '_cr_bg_repeat', "option" => array('no-repeat', 'repeat', 'repeat-x', 'repeat-y'), "std" => 'repeat', "desc" => ''), "crclear2" => array("type" => 'clear_float'), "wrap_crskin_close" => array("type" => 'wraper_close'), "crbodyfontcolor" => array("type" => 'color', "label" => __('Text Font Color for this area', $tid), "id" => $shortname . '_crbody_fontcolor', "std" => 'bcc3c4', "desc" => ''), "crlinkcolor" => array("type" => 'color', "label" => __('Link font color for this area', $tid), "id" => $shortname . '_cr_link_color', "std" => '2999e9', "desc" => ''), "crlinkhovercolor" => array("type" => 'color', "label" => __('Link font color on hover for this area', $tid), "id" => $shortname . '_cr_link_hovercolor', "std" => 'AAAAAA', "desc" => ''), "close_form" => array("type" => 'close_form', "part" => 'copyright_area_skin', "reset" => false)), "product_section" => array("form" => array("type" => 'form', "ajax" => true), "product_lists_label" => array("type" => 'label', "first-row" => true, "label" => __('Settings for product listing', $tid)), "ribbonsale" => array("type" => 'color', "label" => __('"Sale" ribbon background color', $tid), "id" => $shortname . '_sale_ribbon_bg', "std" => '2999e9', "desc" => ''), "ribbonsalefonr" => array("type" => 'color', "label" => __('"Sale" ribbon font color', $tid), "id" => $shortname . '_sale_ribbon_font', "std" => 'fafafa', "desc" => ''), "priceareabg" => array("type" => 'color', "label" => __('Price area background color', $tid), "id" => $shortname . '_price_area_bg', "std" => '4f4f4f', "desc" => ''), "actualpricefont" => array("type" => 'color', "label" => __('Price font color', $tid), "id" => $shortname . '_actual_price_font', "std" => 'f7f7f7', "desc" => 'Price font color'), "product_lists_label_single" => array("type" => 'label', "first-row" => true, "label" => __('Settings for single product page', $tid)), "single_shoppage_price" => array("type" => 'radio', "label" => __('Product Price Ribbon Color', $tid), "id" => $shortname . '_single_shoppage_price', "desc" => __('Select the ribbon color that match with your site style.', $tid), "std" => "dark", "option" => array(__('Dark', $tid), __('Red', $tid), __('Orange', $tid), __('Green', $tid), __('Blue', $tid), __('Yellow', $tid)), "choosen" => array('dark', 'red', 'orange', 'green', 'blue', 'yellow')), "variable_product_price_bg" => array("type" => 'color', "label" => __('"Variable product" price background color', $tid), "id" => $shortname . '_variable_product_price_bg', "std" => 'f3f3f3', "desc" => __('Background color of variable product price', 'wip')), "variable_product_price_color" => array("type" => 'color', "label" => __('"Variable product" price font color', $tid), "id" => $shortname . '_variable_product_price_color', "std" => '2999e9', "desc" => __('Font color of variable product price', 'wip')), "addviewopbuttonsingle" => array("type" => 'color', "label" => __('"Add to cart" button background color on single product page', $tid), "id" => $shortname . '_addtocart_single_bg', "std" => '2999e9', "desc" => ''), "addviewopbuttoncolorsingle" => array("type" => 'color', "label" => __('"Add to cart" button font color on single product page', $tid), "id" => $shortname . '_addtocart_single_font', "std" => 'fcfcfc', "desc" => ''), "close_form" => array("type" => 'close_form', "part" => 'product_section', "reset" => false))), "options" => array("form" => array("type" => 'form', "ajax" => true), "skinlayout" => array("type" => 'radio', "label" => __('Layout Style', $tid), "id" => $shortname . '_skinlayout', "desc" => __('Select a layout style, stretched or boxed layout', $tid), "std" => "box", "option" => array(__('Stretched Layout', $tid), __('Boxed Layout', $tid)), "choosen" => array('full', 'box')), "wrap_allbackgroundcolor" => array("type" => 'wraper', "label" => __('Outer area skin settings for boxed layout', $tid), "area" => 'form_for_bd_allbackgroundcolor'), "allbackgroundcolor" => array("type" => 'color', "label" => __('background color', $tid), "id" => $shortname . '_allbackgroundcolor', "std" => 'e8e8e8'), "allbackgroundimage" => array("type" => 'upload_background', "label" => __('background image', $tid), "id" => $shortname . '_allbackgroundimage', "desc" => ''), "allbackground_bgposition" => array("type" => 'select', "label" => __('Background Position', $tid), "id" => $shortname . '_allbackground_bg_pos', "option" => array('Left Top', 'Left Center', 'Left Bottom', 'Center Top', 'Center Center', 'Center Bottom', 'Right Top', 'Right Center', 'Right Bottom'), "std" => 'Left Top', "desc" => ''), "allbackground_bgattachment" => array("type" => 'select', "label" => __('Background Attachment', $tid), "id" => $shortname . '_allbackground_bg_attach', "option" => array('Scroll', 'Fixed', 'Inherit'), "std" => 'Scroll', "desc" => ''), "allbackground_bgrepeat" => array("type" => 'select', "label" => __('Background Repeat', $tid), "id" => $shortname . '_allbackground_bg_repeat', "option" => array('no-repeat', 'repeat', 'repeat-x', 'repeat-y'), "std" => 'repeat', "desc" => ''), "wrap_allbackgroundcolor_close" => array("type" => 'wraper_close'), "close_form" => array("type" => 'close_form', "part" => 'layout_and_style', "reset" => false)));
    $WIPopt['site_elements'] = array("icon" => get_template_directory_uri() . '/framework/images/tools.png', "options" => array("form" => array("type" => 'form', "ajax" => true), "logo_position" => array("type" => 'radio', "label" => __('Logo position', $tid), "id" => $shortname . '_logo_position', "desc" => '', "std" => "left", "option" => array(__('Left', $tid), __('Right', $tid), __('Center', $tid)), "choosen" => array('left', 'right', 'center')), "top_cart_pos_action" => array("type" => 'radio', "label" => __('Top Shopping Cart Position', $tid), "id" => $shortname . '_top_cart_pos_action', "desc" => '', "std" => "default", "choosen" => array('default', 'scroll'), "option" => array(__('Stay at the header, scroll the window evertime user add item to cart', 'wip'), __('Always visible, sticky style', 'wip'))), "top_search_off" => array("type" => 'onecheck', "label" => __('Turn off the top search bar?', $tid), "id" => $shortname . '_top_search_off', "desc" => '', "std" => "0"), "top_links_beforesearch_off" => array("type" => 'onecheck', "label" => __('Turn off the links before top search form', $tid), "id" => $shortname . '_top_links_beforesearch_off', "desc" => __('Turn off the links before search form? However, these links only shown when woocommerce active', 'wip'), "std" => "1"), "top_shoppingcart_off" => array("type" => 'onecheck', "label" => __('Turn off the top shopping cart', $tid), "id" => $shortname . '_top_shoppingcart_off', "desc" => __('Turn off the top shopping cart? However, this shopping cart only shown when woocommerce active', 'wip'), "std" => "1"), "top_productsearch_off" => array("type" => 'onecheck', "label" => __('Turn off the "product search" form', $tid), "id" => $shortname . '_top_productsearch_off', "desc" => __('Turn off the "product search" form after page title in shop sections? However, this form only shown when woocommerce active', 'wip'), "std" => "1"), "footer_widget_off" => array("type" => 'onecheck', "label" => __('Turn off the footer widgets area', $tid), "id" => $shortname . '_footer_widget_off', "desc" => '', "std" => "1"), "blog_related_off" => array("type" => 'onecheck', "label" => __('Turn off the related posts in blog', $tid), "id" => $shortname . '_blog_related_off', "desc" => '', "std" => "1"), "portfolio_related_off" => array("type" => 'onecheck', "label" => __('Turn off the related projects in portfolio', $tid), "id" => $shortname . '_portfolio_related_off', "desc" => '', "std" => "1"), "close_form" => array("type" => 'close_form', "part" => 'site_elements', "reset" => true)));
    $WIPopt['shop_page'] = array("icon" => get_template_directory_uri() . '/framework/images/commerce.png', "options" => array("form" => array("type" => 'form', "ajax" => true), "shoppage_layout" => array("type" => 'radio', "label" => __('Shop page layout', $tid), "id" => $shortname . '_shoppage_layout', "desc" => __('Select a layout style, for main shop page. Page content manager will not works for this page, since woocommerce handle the content from plugin\'s function!', $tid), "std" => "content-sidebar", "option" => array(__('Content - Sidebar', $tid), __('Sidebar - Content', $tid), __('Fullwidth (no sidebar)', $tid)), "choosen" => array('content-sidebar', 'sidebar-content', 'fullwidth')), "shoppage_columns" => array("type" => 'select', "label" => __('Number of columns', $tid), "id" => $shortname . '_shoppage_columns', "option" => array('2', '3', '4', '5'), "desc" => '', "std" => "4"), "shoppage_sidebar" => array("type" => 'select', "label" => __('Select a sidebar', $tid), "id" => $shortname . '_shoppage_sidebar', "option" => $sidebarOpt, "desc" => '', "std" => "Default Sidebar"), "close_form" => array("type" => 'close_form', "part" => 'shop_page', "reset" => true)));
    $WIPopt['posts_per_page'] = array("icon" => get_template_directory_uri() . '/framework/images/diagram.png', "options" => array("form" => array("type" => 'form', "ajax" => true), "shoppage_postperpage" => array("type" => 'text', "label" => __('Posts per page for shop sections.', $tid), "id" => $shortname . '_shoppage_postperpage', "desc" => __("This setting will also take affect into product tag archive, product category archive, search results for product and any other product related archive pages"), "std" => "12"), "blocat_postperpage" => array("type" => 'text', "label" => __('Posts per page for blog category.', $tid), "id" => $shortname . '_blocat_postperpage', "desc" => __("This setting will also take affect into blog tag archive, date archive and any other blog related archive pages"), "std" => "5"), "portfoliocat_postperpage" => array("type" => 'text', "label" => __('Posts per page for portfolio category.', $tid), "id" => $shortname . '_portfoliocat_postperpage', "desc" => '', "std" => "12"), "search_postperpage" => array("type" => 'text', "label" => __('Posts per page for search results page.', $tid), "id" => $shortname . '_search_postperpage', "desc" => '', "std" => "6"), "close_form" => array("type" => 'close_form', "part" => 'posts_per_page', "reset" => true)));
    $WIPopt['slider_settings'] = array("icon" => get_template_directory_uri() . '/framework/images/right.png', "child" => array("first" => array("title" => __('General Config', $tid)), "nivo_slider_settings" => array("form" => array("type" => 'form', "ajax" => true), "slidereffect" => array("type" => 'selectid', "label" => __('Select an effect for nivoslider', $tid), "id" => $shortname . '_nivo_effect', "option" => array('Random', 'Slice Down', 'Slide Down Left', 'Slice Up', 'Slice Up Left', 'Slice Up Down', 'Slide Up Down Left', 'Fold', 'Fade', 'Slide In Right', 'Slide In Left', 'Box Random', 'Box Rain', 'Box Rain Reserve', 'Box Rain Grow', 'Box Rain Grow Reserve'), "choosen" => array('random', 'sliceDown', 'sliceDownLeft', 'sliceUp', 'sliceUpLeft', 'sliceUpDown', 'sliceUpDownLeft', 'fold', 'fade', 'slideInRight', 'slideInLeft', 'boxRandom', 'boxRain', 'boxRainReverse', 'boxRainGrow', 'boxRainGrowReverse'), "std" => 'random', "desc" => __('Define the effect, default is "random"', $tid)), "animate_time" => array("type" => 'text', "label" => __('Animation time', $tid), "id" => $shortname . '_nivo_speed', "desc" => __('Animated time for each object &raquo; 1000 = 1 second', $tid), "std" => "500"), "nivo_slide_delay" => array("type" => 'text', "label" => __('Delay', $tid), "id" => $shortname . '_nivo_delay', "desc" => __('Delay/Pause time between slider object &raquo; 1000 = 1 second', $tid), "std" => "6000"), "nivoslice" => array("type" => 'text', "label" => __('Slice', $tid), "id" => $shortname . '_nivo_slices', "desc" => __('Define the slices for each image, default is 15', $tid), "std" => "15"), "nivoboxcols" => array("type" => 'text', "label" => __('Box Cols', $tid), "id" => $shortname . '_nivo_boxCols', "desc" => __('Use for box animations. Define number of box cols', $tid), "std" => "8"), "nivoboxrows" => array("type" => 'text', "label" => __('Box Rows', $tid), "id" => $shortname . '_nivo_boxRows', "desc" => __('Use for box animations. Define number of box rows', $tid), "std" => "4"), "nivocap" => array("type" => 'select', "label" => __('Caption opacity', $tid), "id" => $shortname . '_nivo_opacity', "option" => array('0.5', '0.6', '0.7', '0.8', '0.9', '1.00'), "std" => '0.8', "desc" => __('Define the opacity of the caption.', $tid)), "nivo_hoverpause" => array("type" => 'onecheck', "label" => __('Hover Pause', $tid), "id" => $shortname . '_nivo_hoverpause', "desc" => __('Pause the animation on Hover', $tid), "std" => "1"), "close_form" => array("type" => 'close_form', "part" => 'nivo_slider_settings', "reset" => true)), "piecemaker_2_settings" => array("form" => array("type" => 'form', "ajax" => true), "pc_LoaderColor" => array("type" => 'color', "label" => __('Loader Color', $tid), "id" => $shortname . '_pc_LoaderColor', "std" => '333333', "desc" => __('Color of the cubes before the first image appears, also the color of the back sides of the cube, which become visible at some transition types', $tid)), "pc_InnerSideColor" => array("type" => 'color', "label" => __('Inner Side Color', $tid), "id" => $shortname . '_pc_InnerSideColor', "std" => '222222', "desc" => __('Color of the inner sides of the cube when sliced', $tid)), "pc_SideShadowAlpha" => array("type" => 'text', "label" => __('Side Shadow Alpha', $tid), "id" => $shortname . '_pc_SideShadowAlpha', "std" => '0.8', "desc" => __('Sides get darker when moved away from the front. This is the degree of darkness. 0 == no change, 1 == 100% black', $tid)), "pc_DropShadowAlpha" => array("type" => 'text', "label" => __('Drop Shadow Alpha', $tid), "id" => $shortname . '_pc_DropShadowAlpha', "std" => '0.7', "desc" => __('Alpha of the drop shadow. 0 == no shadow, 1 == opaque', $tid)), "pc_DropShadowDistance" => array("type" => 'text', "label" => __('Drop Shadow Distance', $tid), "id" => $shortname . '_pc_DropShadowDistance', "std" => '25', "desc" => __('Distance of the shadow from the bottom of the image', $tid)), "pc_DropShadowScale" => array("type" => 'text', "label" => __('Drop Shadow Scale', $tid), "id" => $shortname . '_pc_DropShadowScale', "std" => '0.95', "desc" => __('The value should between 0 and 1. 1 would be no resizing at all', $tid)), "pc_DropShadowBlurX" => array("type" => 'text', "label" => __('Drop Shadow Blur X', $tid), "id" => $shortname . '_pc_DropShadowBlurX', "std" => '40', "desc" => __('Blur of the drop shadow on the x-axis', $tid)), "pc_DropShadowBlurY" => array("type" => 'text', "label" => __('Drop Shadow Blur Y', $tid), "id" => $shortname . '_pc_DropShadowBlurY', "std" => '4', "desc" => __('Blur of the drop shadow on the y-axis', $tid)), "pc_MenuDistanceX" => array("type" => 'text', "label" => __('Menu Distance X', $tid), "id" => $shortname . '_pc_MenuDistanceX', "std" => '20', "desc" => __('Distance between two menu items (from center to center)', $tid)), "pc_MenuDistanceY" => array("type" => 'text', "label" => __('Menu Distance Y', $tid), "id" => $shortname . '_pc_MenuDistanceY', "std" => '50', "desc" => __('Distance of the menu from the bottom of the image', $tid)), "pc_MenuColor1" => array("type" => 'color', "label" => __('Menu Color 1', $tid), "id" => $shortname . '_pc_MenuColor1', "std" => '999999', "desc" => __('Color of an inactive menu item', $tid)), "pc_MenuColor2" => array("type" => 'color', "label" => __('Menu Color 2', $tid), "id" => $shortname . '_pc_MenuColor2', "std" => '333333', "desc" => __('Color of an active menu item', $tid)), "pc_MenuColor3" => array("type" => 'color', "label" => __('Menu Color 3', $tid), "id" => $shortname . '_pc_MenuColor3', "std" => 'FFFFFF', "desc" => __('Color of the inner circle of an active menu item. Should equal the background color of the whole thing.', $tid)), "pc_ControlSize" => array("type" => 'text', "label" => __('Control Size', $tid), "id" => $shortname . '_pc_ControlSize', "std" => '100', "desc" => __('Size of the controls, which appear on rollover (play, stop, info, link)', $tid)), "pc_ControlDistance" => array("type" => 'text', "label" => __('Control Distance', $tid), "id" => $shortname . '_pc_ControlDistance', "std" => '20', "desc" => __('Distance between the controls (from the borders)', $tid)), "pc_ControlColor1" => array("type" => 'color', "label" => __('Control Color 1', $tid), "id" => $shortname . '_pc_ControlColor1', "std" => '222222', "desc" => __('Background color of the controls', $tid)), "pc_ControlColor2" => array("type" => 'color', "label" => __('Control Color 2', $tid), "id" => $shortname . '_pc_ControlColor2', "std" => 'FFFFFF', "desc" => __('Font color of the controls', $tid)), "pc_ControlAlpha" => array("type" => 'text', "label" => __('Control Alpha', $tid), "id" => $shortname . '_pc_ControlAlpha', "std" => '0.8', "desc" => __('Alpha of a control, when mouse is not over', $tid)), "pc_ControlAlphaOver" => array("type" => 'text', "label" => __('Control Alpha Over', $tid), "id" => $shortname . '_pc_ControlAlphaOver', "std" => '0.95', "desc" => __('Alpha of a control, when mouse is over', $tid)), "pc_TooltipHeight" => array("type" => 'text', "label" => __('Tooltip Height', $tid), "id" => $shortname . '_pc_TooltipHeight', "std" => '32', "desc" => __('Height of the tooltip surface in the menu', $tid)), "pc_TooltipColor" => array("type" => 'color', "label" => __('Tooltip Color', $tid), "id" => $shortname . '_pc_TooltipColor', "std" => '222222', "desc" => __('Color of the tooltip surface in the menu', $tid)), "pc_TooltipTextColor" => array("type" => 'color', "label" => __('Tooltip Text Color', $tid), "id" => $shortname . '_pc_TooltipTextColor', "std" => 'FFFFFF', "desc" => __('Color of the tooltip text', $tid)), "pc_TooltipTextSharpness" => array("type" => 'text', "label" => __('Tooltip Text Sharpness', $tid), "id" => $shortname . '_pc_TooltipTextSharpness', "std" => '50', "desc" => __('Sharpness of the tooltip text (-400 to 400)', $tid)), "pc_TooltipTextThickness" => array("type" => 'text', "label" => __('Tooltip Text Thickness', $tid), "id" => $shortname . '_pc_TooltipTextThickness', "std" => '-100', "desc" => __('Thickness of the tooltip text (-400 to 400)', $tid)), "pc_InfoWidth" => array("type" => 'text', "label" => __('Info Width', $tid), "id" => $shortname . '_pc_InfoWidth', "std" => '400', "desc" => __('The width of the info text field', $tid)), "pc_InfoBackground" => array("type" => 'color', "label" => __('Info Background', $tid), "id" => $shortname . '_pc_InfoBackground', "std" => 'FFFFFF', "desc" => __('The background color of the info text field', $tid)), "pc_InfoBackgroundAlpha" => array("type" => 'text', "label" => __('Info Background Alpha', $tid), "id" => $shortname . '_pc_InfoBackgroundAlpha', "std" => '0.95', "desc" => __('The alpha of the background of the info text. The image shines through, when smaller than 1', $tid)), "pc_Autoplay" => array("type" => 'text', "label" => __('Autoplay', $tid), "id" => $shortname . '_pc_Autoplay', "std" => '10', "desc" => __('Number of seconds from one transition to another, if not stopped. Set to 0 to disable autoplay', $tid)), "close_form" => array("type" => 'close_form', "part" => 'piecemaker_2_settings', "reset" => true))), "options" => array("form" => array("type" => 'form', "ajax" => true), "slidertype" => array("type" => 'radio', "label" => __('Select a slider', $tid), "id" => $shortname . '_slidertype', "desc" => '', "std" => "nivo", "option" => array(__('Piecemaker 2', $tid), __('Nivo Slider', $tid)), "choosen" => array('flash', 'nivo')), "sliderHeight" => array("type" => 'text', "label" => __('Slider Height', $tid), "id" => $shortname . '_sliderHeight', "desc" => __('The Container Height of Slider, in pixels!', $tid), "std" => "400"), "close_form" => array("type" => 'close_form', "part" => 'slider_settings', "reset" => true)));
    $WIPopt['slider_image'] = array("icon" => get_template_directory_uri() . '/framework/images/jquery_icon.png', "options" => array("wipslider" => array("type" => 'slider', "shortname" => $shortname)));
    $WIPopt['contact_form'] = array("icon" => get_template_directory_uri() . '/framework/images/letter.png', "options" => array("form" => array("type" => 'form', "ajax" => true), "contact_label" => array("type" => 'label', "first-row" => true, "label" => __('To use contact form, please enter the shortcode <strong>[contactform]</strong> in any page', $tid)), "cf_email" => array("type" => 'text', "label" => __('Email address', $tid), "id" => $shortname . '_cf_email', "desc" => __('Enter the email address that will integrated with Contact form', $tid), "std" => get_option('admin_email')), "cf_success" => array("type" => 'text', "label" => __('Success message', $tid), "id" => $shortname . '_cf_success', "desc" => __('Enter the success message.', $tid), "std" => 'Thankyou, your message has been sent!'), "cf_auto" => array("type" => 'onecheck', "label" => __('Use Auto Responder?', $tid), "id" => $shortname . '_cf_auto', "desc" => '', "std" => "0"), "cf_subject_res" => array("type" => 'text', "label" => __('Auto responder email subject', $tid), "id" => $shortname . '_cf_subject_res', "desc" => __('Enter the auto responder email subject', $tid), "std" => 'Thankyou for contacting me!'), "cf_auto_res" => array("type" => 'textarea', "label" => __('Auto Responder message', $tid), "id" => $shortname . '_cf_auto_res', "desc" => __('Enter the auto responder message,<br/>use {name} &raquo; automatically change with the sender\'s name<br/>and {email} &raquo; automatically change with the sender\'s email address', $tid), "std" => "Hello {name} - {email}," . Chr(13) . Chr(13) . "Thankyou for contacting me via contact form in my contact page. I will make respond into your message as soon as possible" . Chr(13) . Chr(13) . "Sincerely," . Chr(13) . "Site Owner."), "close_form" => array("type" => 'close_form', "part" => 'contact_form', "reset" => true)));
    $WIPopt['social_icons'] = array("icon" => get_template_directory_uri() . '/framework/images/tw.png', "options" => array("wipico" => array("type" => 'upload_icons', "shortname" => $shortname)));
    $WIPopt['custom_sidebar'] = array("icon" => get_template_directory_uri() . '/framework/images/monitor_32.png', "options" => array("wipsidebar" => array("type" => 'add_sidebar', "shortname" => $shortname)));
    $Options = $WIPopt;
    return $Options;
}
Example #15
0
function gettypere($flag, $tn)
{
    $res = 0;
    if ($flag == "art") {
        $typearr = $GLOBALS['MAC_CACHE']['arttype'];
        $file = "../inc/config/interface_arttype.txt";
    } else {
        $typearr = $GLOBALS['MAC_CACHE']['vodtype'];
        $file = "../inc/config/interface_vodtype.txt";
    }
    if (strpos($tn, '/')) {
        $arr = explode('/', $tn);
        $tn = trim($arr[0]);
        unset($arr);
    }
    $str = file_get_contents($file);
    if (!isN($str)) {
        $str = str_replace(Chr(10), Chr(13), $str);
        $arr1 = explode(Chr(13), $str);
        for ($i = 0; $i < count($arr1); $i++) {
            if (!isN($arr1[$i])) {
                $str1 = $arr1[$i];
                $arr2 = explode("=", $str1);
                if (trim($tn) == trim($arr2[1])) {
                    foreach ($typearr as $t) {
                        if (trim($t["t_name"]) == trim($arr2[0])) {
                            return $t["t_id"];
                            break;
                        }
                    }
                    break;
                }
            }
        }
    }
}
Example #16
0
 /**
  * reads a frame from the file
  *
  * @return mixed PEAR_Error when fails
  * @access private
  */
 function _readframe()
 {
     if ($this->debug) {
         print $this->debugbeg . "_readframe()<HR>\n";
     }
     $file = $this->file;
     $mqr = get_magic_quotes_runtime();
     set_magic_quotes_runtime(0);
     if (!($f = fopen($file, 'rb'))) {
         if ($this->debug) {
             print $this->debugend;
         }
         return PEAR::raiseError("Unable to open " . $file, PEAR_MP3_ID_FNO);
     }
     $this->filesize = filesize($file);
     do {
         while (fread($f, 1) != Chr(255)) {
             // Find the first frame
             if ($this->debug) {
                 echo "Find...\n";
             }
             if (feof($f)) {
                 if ($this->debug) {
                     print $this->debugend;
                 }
                 return PEAR::raiseError("No mpeg frame found", PEAR_MP3_ID_NOMP3);
             }
         }
         fseek($f, ftell($f) - 1);
         // back up one byte
         $frameoffset = ftell($f);
         $r = fread($f, 4);
         // Binary to Hex to a binary sting. ugly but best I can think of.
         // $bits = unpack('H*bits', $r);
         // $bits =  base_convert($bits['bits'],16,2);
         $bits = sprintf("%'08b%'08b%'08b%'08b", ord($r[0]), ord($r[1]), ord($r[2]), ord($r[3]));
     } while (!$bits[8] and !$bits[9] and !$bits[10]);
     // 1st 8 bits true from the while
     if ($this->debug) {
         print 'Bits: ' . $bits . "\n";
     }
     $this->frameoffset = $frameoffset;
     // Detect VBR header
     if ($bits[11] == 0) {
         if ($bits[24] == 1 && $bits[25] == 1) {
             $vbroffset = 9;
             // MPEG 2.5 Mono
         } else {
             $vbroffset = 17;
             // MPEG 2.5 Stereo
         }
     } else {
         if ($bits[12] == 0) {
             if ($bits[24] == 1 && $bits[25] == 1) {
                 $vbroffset = 9;
                 // MPEG 2 Mono
             } else {
                 $vbroffset = 17;
                 // MPEG 2 Stereo
             }
         } else {
             if ($bits[24] == 1 && $bits[25] == 1) {
                 $vbroffset = 17;
                 // MPEG 1 Mono
             } else {
                 $vbroffset = 32;
                 // MPEG 1 Stereo
             }
         }
     }
     fseek($f, ftell($f) + $vbroffset);
     $r = fread($f, 4);
     switch ($r) {
         case 'Xing':
             $this->encoding_type = 'VBR';
         case 'Info':
             // Extract info from Xing header
             if ($this->debug) {
                 print 'Encoding Header: ' . $r . "\n";
             }
             $r = fread($f, 4);
             $vbrbits = sprintf("%'08b", ord($r[3]));
             if ($this->debug) {
                 print 'XING Header Bits: ' . $vbrbits . "\n";
             }
             if ($vbrbits[7] == 1) {
                 // Next 4 bytes contain number of frames
                 $r = fread($f, 4);
                 $this->frames = unpack('N', $r);
                 $this->frames = $this->frames[1];
             }
             if ($vbrbits[6] == 1) {
                 // Next 4 bytes contain number of bytes
                 $r = fread($f, 4);
                 $this->musicsize = unpack('N', $r);
                 $this->musicsize = $this->musicsize[1];
             }
             if ($vbrbits[5] == 1) {
                 // Next 100 bytes contain TOC entries, skip
                 fseek($f, ftell($f) + 100);
             }
             if ($vbrbits[4] == 1) {
                 // Next 4 bytes contain Quality Indicator
                 $r = fread($f, 4);
                 $this->quality = unpack('N', $r);
                 $this->quality = $this->quality[1];
             }
             break;
         case 'VBRI':
         default:
             if ($vbroffset != 32) {
                 // VBRI Header is fixed after 32 bytes, so maybe we are looking at the wrong place.
                 fseek($f, ftell($f) + 32 - $vbroffset);
                 $r = fread($f, 4);
                 if ($r != 'VBRI') {
                     $this->encoding_type = 'CBR';
                     break;
                 }
             } else {
                 $this->encoding_type = 'CBR';
                 break;
             }
             if ($this->debug) {
                 print 'Encoding Header: ' . $r . "\n";
             }
             $this->encoding_type = 'VBR';
             // Next 2 bytes contain Version ID, skip
             fseek($f, ftell($f) + 2);
             // Next 2 bytes contain Delay, skip
             fseek($f, ftell($f) + 2);
             // Next 2 bytes contain Quality Indicator
             $r = fread($f, 2);
             $this->quality = unpack('n', $r);
             $this->quality = $this->quality[1];
             // Next 4 bytes contain number of bytes
             $r = fread($f, 4);
             $this->musicsize = unpack('N', $r);
             $this->musicsize = $this->musicsize[1];
             // Next 4 bytes contain number of frames
             $r = fread($f, 4);
             $this->frames = unpack('N', $r);
             $this->frames = $this->frames[1];
     }
     fclose($f);
     set_magic_quotes_runtime($mqr);
     if ($bits[11] == 0) {
         $this->mpeg_ver = "2.5";
         $bitrates = array('1' => array(0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0), '2' => array(0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0), '3' => array(0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0));
     } else {
         if ($bits[12] == 0) {
             $this->mpeg_ver = "2";
             $bitrates = array('1' => array(0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0), '2' => array(0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0), '3' => array(0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0));
         } else {
             $this->mpeg_ver = "1";
             $bitrates = array('1' => array(0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 0), '2' => array(0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 0), '3' => array(0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0));
         }
     }
     if ($this->debug) {
         print 'MPEG' . $this->mpeg_ver . "\n";
     }
     $layer = array(array(0, 3), array(2, 1));
     $this->layer = $layer[$bits[13]][$bits[14]];
     if ($this->debug) {
         print 'layer: ' . $this->layer . "\n";
     }
     if ($bits[15] == 0) {
         // It's backwards, if the bit is not set then it is protected.
         if ($this->debug) {
             print "protected (crc)\n";
         }
         $this->crc = true;
     }
     $bitrate = 0;
     if ($bits[16] == 1) {
         $bitrate += 8;
     }
     if ($bits[17] == 1) {
         $bitrate += 4;
     }
     if ($bits[18] == 1) {
         $bitrate += 2;
     }
     if ($bits[19] == 1) {
         $bitrate += 1;
     }
     $this->bitrate = $bitrates[$this->layer][$bitrate];
     $frequency = array('1' => array('0' => array(44100, 48000), '1' => array(32000, 0)), '2' => array('0' => array(22050, 24000), '1' => array(16000, 0)), '2.5' => array('0' => array(11025, 12000), '1' => array(8000, 0)));
     $this->frequency = $frequency[$this->mpeg_ver][$bits[20]][$bits[21]];
     $this->padding = $bits[22];
     $this->private = $bits[23];
     $mode = array(array('Stereo', 'Joint Stereo'), array('Dual Channel', 'Mono'));
     $this->mode = $mode[$bits[24]][$bits[25]];
     // XXX: I dunno what the mode extension is for bits 26,27
     $this->copyright = $bits[28];
     $this->original = $bits[29];
     $emphasis = array(array('none', '50/15ms'), array('', 'CCITT j.17'));
     $this->emphasis = $emphasis[$bits[30]][$bits[31]];
     $samplesperframe = array('1' => array('1' => 384, '2' => 1152, '3' => 1152), '2' => array('1' => 384, '2' => 1152, '3' => 576), '2.5' => array('1' => 384, '2' => 1152, '3' => 576));
     $this->samples_per_frame = $samplesperframe[$this->mpeg_ver][$this->layer];
     if ($this->encoding_type != 'VBR') {
         if ($this->bitrate == 0) {
             $s = -1;
         } else {
             $s = 8 * filesize($this->file) / 1000 / $this->bitrate;
         }
         $this->length = sprintf('%02d:%02d', floor($s / 60), floor($s - floor($s / 60) * 60));
         $this->lengthh = sprintf('%02d:%02d:%02d', floor($s / 3600), floor($s / 60), floor($s - floor($s / 60) * 60));
         $this->lengths = (int) $s;
         $this->samples = ceil($this->lengths * $this->frequency);
         if (0 != $this->samples_per_frame) {
             $this->frames = ceil($this->samples / $this->samples_per_frame);
         } else {
             $this->frames = 0;
         }
         $this->musicsize = ceil($this->lengths * $this->bitrate * 1000 / 8);
     } else {
         $this->samples = $this->samples_per_frame * $this->frames;
         $s = $this->samples / $this->frequency;
         $this->length = sprintf('%02d:%02d', floor($s / 60), floor($s - floor($s / 60) * 60));
         $this->lengthh = sprintf('%02d:%02d:%02d', floor($s / 3600), floor($s / 60), floor($s - floor($s / 60) * 60));
         $this->lengths = (int) $s;
         $this->bitrate = (int) ($this->musicsize / $s * 8 / 1000);
     }
     if ($this->debug) {
         print $this->debugend;
     }
 }
Example #17
0
function Tokens($astr, $longtoken, $lcp, $cs)
{
    $tokens = fopen("ti82tokens.dat", "rb");
    fseek($tokens, 0);
    for ($i = 0; $i < filesize("ti83tokens.dat") / 16; $i++) {
        fseek($tokens, $i * 16);
        for ($j = 0; $j < 16; $j++) {
            $MP[$i][$j] = ord(fread($tokens, 1));
            //               echo "'".$MP[$i][$j].'"';
        }
    }
    fclose($tokens);
    $cChar = "";
    $bytecnt = -1;
    $twobyte = 0;
    $tableindex = -1;
    while (true) {
        $tableindex++;
        if ($tableindex > count($MP) - 1) {
            return $astr;
        }
        $BS = '';
        for ($i = 0; $i < count($MP[$tableindex]); $i++) {
            if ($MP[$tableindex][$i] > 0xf) {
                $BS .= chr($MP[$tableindex][$i]);
            }
        }
        $bytecnt++;
        $d = $BS;
        if ($d == "") {
            return $astr;
        } else {
            if ($d == chr(38) . '$black') {
                continue;
            }
        }
        if ($longtoken) {
            if (strlen($d) == 1) {
                continue;
            }
        } else {
            if (strlen($d) > 1 && $d[0] != chr(38)) {
                continue;
            }
        }
        if ($lcp && strlen($d) == 1 && ord($d[0]) > 96 && ord($d[0]) < 123 && $twobyte != 187) {
            continue;
        }
        if (strlen($d) > 1 && ord($d[0]) == 38 && $d[1] == '!') {
            $twobyte = substr($d, 2);
            $bytecnt = -1;
            continue;
        }
        $cChar = Chr($bytecnt);
        if ($twobyte > 0) {
            $cChar = chr($twobyte) . $cChar;
        }
        if ($d == Chr(38) . '#CRLF') {
            $astr = ReplaceStrb($astr, "", $cChar . 'ï');
        } else {
            $pos = -1;
            while (true) {
                $pos = InStr($pos + 2, $astr, $d, $cs);
                $pos = $pos == false ? 0 : $pos;
                if ($pos == 0) {
                    break;
                }
                $s1 = InStrRev($astr, 'ï', $pos);
                $s2 = InStrRev($astr, chr(38), $pos);
                if ($s1 > $s2 || $s2 == 0) {
                    $astr = substr($astr, 0, $pos) . chr(38) . $cChar . "ï" . substr($astr, $pos + strlen($d));
                }
            }
        }
        //      echo $BS.'<br>';
    }
    /*
            pos := -1;
            repeat
              pos := InStr(pos+2, astr, d, cs);
                if pos = 0 then
                  Break;
              s1 := InStrRev(astr, 'ï', pos);
              s2 := InStrRev(astr, Chr(38), pos);
              if (s1 > s2) or (s2=0) then
                astr := copy(astr, 1, pos - 1) + Chr(38)+ cChar + 'ï' + copy(astr, pos+length(d), length(astr)-pos-length(d)+1);
            until false;
          end;
      goto Beginning;
    lEnd:
    */
}
Example #18
0
 function SubValLetra($numero)
 {
     $Ptr = "";
     $n = 0;
     $i = 0;
     $x = "";
     $Rtn = "";
     $Tem = "";
     $x = trim("{$numero}");
     $n = strlen($x);
     $Tem = $this->Void;
     $i = $n;
     while ($i > 0) {
         $Tem = $this->Parte(intval(substr($x, $n - $i, 1) . str_repeat($this->Zero, $i - 1)));
         if ($Tem != "Cero") {
             $Rtn .= $Tem . $this->SP;
         }
         $i = $i - 1;
     }
     //--------------------- GoSub FiltroMil ------------------------------
     $Rtn = str_replace(" Mil Mil", " Un Mil", $Rtn);
     while (1) {
         $Ptr = strpos($Rtn, "Mil ");
         if (!($Ptr === false)) {
             if (!(strpos($Rtn, "Mil ", $Ptr + 1) === false)) {
                 $this->ReplaceStringFrom($Rtn, "Mil ", "", $Ptr);
             } else {
                 break;
             }
         } else {
             break;
         }
     }
     //--------------------- GoSub FiltroCiento ------------------------------
     $Ptr = -1;
     do {
         $Ptr = strpos($Rtn, "Cien ", $Ptr + 1);
         if (!($Ptr === false)) {
             $Tem = substr($Rtn, $Ptr + 5, 1);
             if ($Tem == "M" || $Tem == $this->Void) {
             } else {
                 $this->ReplaceStringFrom($Rtn, "Cien", "Ciento", $Ptr);
             }
         }
     } while (!($Ptr === false));
     //--------------------- FiltroEspeciales ------------------------------
     $Rtn = str_replace("Diez Un", "Once", $Rtn);
     $Rtn = str_replace("Diez Dos", "Doce", $Rtn);
     $Rtn = str_replace("Diez Tres", "Trece", $Rtn);
     $Rtn = str_replace("Diez Cuatro", "Catorce", $Rtn);
     $Rtn = str_replace("Diez Cinco", "Quince", $Rtn);
     $Rtn = str_replace("Diez Seis", "Dieciseis", $Rtn);
     $Rtn = str_replace("Diez Siete", "Diecisiete", $Rtn);
     $Rtn = str_replace("Diez Ocho", "Dieciocho", $Rtn);
     $Rtn = str_replace("Diez Nueve", "Diecinueve", $Rtn);
     $Rtn = str_replace("Veinte Un", "Veintiun", $Rtn);
     $Rtn = str_replace("Veinte Dos", "Veintidos", $Rtn);
     $Rtn = str_replace("Veinte Tres", "Veintitres", $Rtn);
     $Rtn = str_replace("Veinte Cuatro", "Veinticuatro", $Rtn);
     $Rtn = str_replace("Veinte Cinco", "Veinticinco", $Rtn);
     $Rtn = str_replace("Veinte Seis", "Veintiseís", $Rtn);
     $Rtn = str_replace("Veinte Siete", "Veintisiete", $Rtn);
     $Rtn = str_replace("Veinte Ocho", "Veintiocho", $Rtn);
     $Rtn = str_replace("Veinte Nueve", "Veintinueve", $Rtn);
     //--------------------- FiltroUn ------------------------------
     if (substr($Rtn, 0, 1) == "M") {
         $Rtn = "Un " . $Rtn;
     }
     //--------------------- Adicionar Y ------------------------------
     for ($i = 65; $i <= 88; $i++) {
         if ($i != 77) {
             $Rtn = str_replace("a " . Chr($i), "* y " . Chr($i), $Rtn);
         }
     }
     $Rtn = str_replace("*", "a", $Rtn);
     return $Rtn;
 }
 function ExtractFile($header, $to, $zip)
 {
     $header = $this->readfileheader($zip);
     if (substr($to, -1) != "/") {
         $to .= "/";
     }
     if ($to == './') {
         $to = '';
     }
     $pth = explode("/", $to . $header['filename']);
     $mydir = '';
     for ($i = 0; $i < count($pth) - 1; $i++) {
         if (!$pth[$i]) {
             continue;
         }
         $mydir .= $pth[$i] . "/";
         if (!is_dir($mydir) && @mkdir($mydir, 0777) || ($mydir == $to . $header['filename'] || $mydir == $to && $this->total_folders == 0) && is_dir($mydir)) {
             @chmod($mydir, 0777);
             $this->total_folders++;
             echo "目录: {$mydir}<br>";
         }
     }
     if (strrchr($header['filename'], '/') == '/') {
         return;
     }
     if (!($header['external'] == 0x41ff0010) && !($header['external'] == 16)) {
         if ($header['compression'] == 0) {
             $fp = @fopen($to . $header['filename'], 'wb');
             if (!$fp) {
                 return -1;
             }
             $size = $header['compressed_size'];
             while ($size != 0) {
                 $read_size = $size < 2048 ? $size : 2048;
                 $buffer = fread($zip, $read_size);
                 $binary_data = pack('a' . $read_size, $buffer);
                 @fwrite($fp, $binary_data, $read_size);
                 $size -= $read_size;
             }
             fclose($fp);
             touch($to . $header['filename'], $header['mtime']);
         } else {
             $fp = @fopen($to . $header['filename'] . '.gz', 'wb');
             if (!$fp) {
                 return -1;
             }
             $binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($header['compression']), Chr(0x0), time(), Chr(0x0), Chr(3));
             fwrite($fp, $binary_data, 10);
             $size = $header['compressed_size'];
             while ($size != 0) {
                 $read_size = $size < 1024 ? $size : 1024;
                 $buffer = fread($zip, $read_size);
                 $binary_data = pack('a' . $read_size, $buffer);
                 @fwrite($fp, $binary_data, $read_size);
                 $size -= $read_size;
             }
             $binary_data = pack('VV', $header['crc'], $header['size']);
             fwrite($fp, $binary_data, 8);
             fclose($fp);
             $gzp = @gzopen($to . $header['filename'] . '.gz', 'rb') or die("Cette archive est compress");
             if (!$gzp) {
                 return -2;
             }
             $fp = @fopen($to . $header['filename'], 'wb');
             if (!$fp) {
                 return -1;
             }
             $size = $header['size'];
             while ($size != 0) {
                 $read_size = $size < 2048 ? $size : 2048;
                 $buffer = gzread($gzp, $read_size);
                 $binary_data = pack('a' . $read_size, $buffer);
                 @fwrite($fp, $binary_data, $read_size);
                 $size -= $read_size;
             }
             fclose($fp);
             gzclose($gzp);
             touch($to . $header['filename'], $header['mtime']);
             @unlink($to . $header['filename'] . '.gz');
         }
     }
     $this->total_files++;
     echo "文件: {$to}{$header['filename']}<br>";
     return true;
 }
Example #20
0
 private function ExtractFile($header, $to, $zip)
 {
     $header = $this->readfileheader($zip);
     if (substr($to, -1) != "/") {
         $to .= "/";
     }
     if (!@is_dir($to)) {
         @mkdir($to, 0777);
     }
     $pth = explode("/", dirname($header['filename']));
     for ($i = 0; isset($pth[$i]); $i++) {
         if (!$pth[$i]) {
             continue;
         }
         $pthss .= $pth[$i] . "/";
         if (!is_dir($to . $pthss)) {
             @mkdir($to . $pthss, 0777);
         }
     }
     if (!($header['external'] == 0x41ff0010) && !($header['external'] == 16)) {
         if ($header['compression'] == 0) {
             $fp = @fopen($to . $header['filename'], 'wb');
             if (!$fp) {
                 return -1;
             }
             $size = $header['compressed_size'];
             while ($size != 0) {
                 $read_size = $size < 2048 ? $size : 2048;
                 $buffer = fread($zip, $read_size);
                 $binary_data = pack('a' . $read_size, $buffer);
                 @fwrite($fp, $binary_data, $read_size);
                 $size -= $read_size;
             }
             fclose($fp);
             touch($to . $header['filename'], $header['mtime']);
         } else {
             $fp = @fopen($to . $header['filename'] . '.gz', 'wb');
             if (!$fp) {
                 return -1;
             }
             $binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($header['compression']), Chr(0x0), time(), Chr(0x0), Chr(3));
             fwrite($fp, $binary_data, 10);
             $size = $header['compressed_size'];
             while ($size != 0) {
                 $read_size = $size < 1024 ? $size : 1024;
                 $buffer = fread($zip, $read_size);
                 $binary_data = pack('a' . $read_size, $buffer);
                 @fwrite($fp, $binary_data, $read_size);
                 $size -= $read_size;
             }
             $binary_data = pack('VV', $header['crc'], $header['size']);
             fwrite($fp, $binary_data, 8);
             fclose($fp);
             $gzp = @gzopen($to . $header['filename'] . '.gz', 'rb') or die("Cette archive est compress!");
             if (!$gzp) {
                 return -2;
             }
             $fp = @fopen($to . $header['filename'], 'wb');
             if (!$fp) {
                 return -1;
             }
             $size = $header['size'];
             while ($size != 0) {
                 $read_size = $size < 2048 ? $size : 2048;
                 $buffer = gzread($gzp, $read_size);
                 $binary_data = pack('a' . $read_size, $buffer);
                 @fwrite($fp, $binary_data, $read_size);
                 $size -= $read_size;
             }
             fclose($fp);
             gzclose($gzp);
             touch($to . $header['filename'], $header['mtime']);
             @unlink($to . $header['filename'] . '.gz');
         }
     }
     return true;
 }
Example #21
0
 function Connect($host_name, $host_port, $ssl, $server_type = 'HTTP')
 {
     $domain = $host_name;
     $port = $host_port;
     if (strlen($error = $this->Resolve($domain, $ip, $server_type))) {
         return $error;
     }
     if (strlen($this->socks_host_name)) {
         switch ($this->socks_version) {
             case '4':
                 $version = 4;
                 break;
             case '5':
                 $version = 5;
                 break;
             default:
                 return 'it was not specified a supported SOCKS protocol version';
                 break;
         }
         $host_ip = $ip;
         $port = $this->socks_host_port;
         $host_server_type = $server_type;
         $server_type = 'SOCKS';
         if (strlen($error = $this->Resolve($this->socks_host_name, $ip, $server_type))) {
             return $error;
         }
     }
     if ($this->debug) {
         $this->OutputDebug('Connecting to ' . $server_type . ' server IP ' . $ip . ' port ' . $port . '...');
     }
     if ($ssl) {
         $ip = "ssl://" . $ip;
     }
     if (($this->connection = $this->timeout ? @fsockopen($ip, $port, $errno, $error, $this->timeout) : @fsockopen($ip, $port, $errno)) == 0) {
         switch ($errno) {
             case -3:
                 return $this->SetError("-3 socket could not be created");
             case -4:
                 return $this->SetError("-4 dns lookup on hostname \"" . $host_name . "\" failed");
             case -5:
                 return $this->SetError("-5 connection refused or timed out");
             case -6:
                 return $this->SetError("-6 fdopen() call failed");
             case -7:
                 return $this->SetError("-7 setvbuf() call failed");
             default:
                 return $this->SetPHPError($errno . " could not connect to the host \"" . $host_name . "\"", $php_errormsg);
         }
     } else {
         if ($this->data_timeout && function_exists("socket_set_timeout")) {
             socket_set_timeout($this->connection, $this->data_timeout, 0);
         }
         if (strlen($this->socks_host_name)) {
             if ($this->debug) {
                 $this->OutputDebug('Connected to the SOCKS server ' . $this->socks_host_name);
             }
             $send_error = 'it was not possible to send data to the SOCKS server';
             $receive_error = 'it was not possible to receive data from the SOCKS server';
             switch ($version) {
                 case 4:
                     $command = 1;
                     if (!fputs($this->connection, chr($version) . chr($command) . pack('nN', $host_port, ip2long($host_ip)) . $this->user . Chr(0))) {
                         $error = $this->SetDataAccessError($send_error);
                     } else {
                         $response = fgets($this->connection, 9);
                         if (strlen($response) != 8) {
                             $error = $this->SetDataAccessError($receive_error);
                         } else {
                             $socks_errors = array("Z" => '', "[" => 'request rejected', "\\" => 'request failed because client is not running identd (or not reachable from the server)', "]" => 'request failed because client\'s identd could not confirm the user ID string in the request');
                             $error_code = $response[1];
                             $error = isset($socks_errors[$error_code]) ? $socks_errors[$error_code] : 'unknown';
                             if (strlen($error)) {
                                 $error = 'SOCKS error: ' . $error;
                             }
                         }
                     }
                     break;
                 case 5:
                     if ($this->debug) {
                         $this->OutputDebug('Negotiating the authentication method ...');
                     }
                     $methods = 1;
                     $method = 0;
                     if (!fputs($this->connection, chr($version) . chr($methods) . chr($method))) {
                         $error = $this->SetDataAccessError($send_error);
                     } else {
                         $response = fgets($this->connection, 3);
                         if (strlen($response) != 2) {
                             $error = $this->SetDataAccessError($receive_error);
                         } elseif (Ord($response[1]) != $method) {
                             $error = 'the SOCKS server requires an authentication method that is not yet supported';
                         } else {
                             if ($this->debug) {
                                 $this->OutputDebug('Connecting to ' . $host_server_type . ' server IP ' . $host_ip . ' port ' . $host_port . '...');
                             }
                             $command = 1;
                             $address_type = 1;
                             if (!fputs($this->connection, chr($version) . chr($command) . "" . chr($address_type) . pack('Nn', ip2long($host_ip), $host_port))) {
                                 $error = $this->SetDataAccessError($send_error);
                             } else {
                                 $response = fgets($this->connection, 11);
                                 if (strlen($response) != 10) {
                                     $error = $this->SetDataAccessError($receive_error);
                                 } else {
                                     $socks_errors = array("" => '', "" => 'general SOCKS server failure', "" => 'connection not allowed by ruleset', "" => 'Network unreachable', "" => 'Host unreachable', "" => 'Connection refused', "" => 'TTL expired', "" => 'Command not supported', "" => 'Address type not supported');
                                     $error_code = $response[1];
                                     $error = isset($socks_errors[$error_code]) ? $socks_errors[$error_code] : 'unknown';
                                     if (strlen($error)) {
                                         $error = 'SOCKS error: ' . $error;
                                     }
                                 }
                             }
                         }
                     }
                     break;
                 default:
                     $error = 'support for SOCKS protocol version ' . $this->socks_version . ' is not yet implemented';
                     break;
             }
             if (strlen($error)) {
                 fclose($this->connection);
                 return $error;
             }
         }
         if ($this->debug) {
             $this->OutputDebug("Connected to {$host_name}");
         }
         if (strlen($this->proxy_host_name) && !strcmp(strtolower($this->protocol), 'https')) {
             if (function_exists('stream_socket_enable_crypto') && in_array('ssl', stream_get_transports())) {
                 $this->state = "ConnectedToProxy";
             } else {
                 $this->OutputDebug("It is not possible to start SSL after connecting to the proxy server. If the proxy refuses to forward the SSL request, you may need to upgrade to PHP 5.1 or later with OpenSSL support enabled.");
                 $this->state = "Connected";
             }
         } else {
             $this->state = "Connected";
         }
         return "";
     }
 }
Example #22
0
 function privExtractFileUsingTempFile(&$p_entry, &$p_options)
 {
     $v_result = 1;
     // ----- Creates a temporary file
     $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.gz';
     if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) {
         fclose($v_file);
         PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary write mode');
         return PclZip::errorCode();
     }
     // ----- Write gz file format header
     $v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x0), time(), Chr(0x0), Chr(3));
     @fwrite($v_dest_file, $v_binary_data, 10);
     // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
     $v_size = $p_entry['compressed_size'];
     while ($v_size != 0) {
         $v_read_size = $v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE;
         $v_buffer = @fread($this->zip_fd, $v_read_size);
         //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
         @fwrite($v_dest_file, $v_buffer, $v_read_size);
         $v_size -= $v_read_size;
     }
     // ----- Write gz file format footer
     $v_binary_data = pack('VV', $p_entry['crc'], $p_entry['size']);
     @fwrite($v_dest_file, $v_binary_data, 8);
     // ----- Close the temporary file
     @fclose($v_dest_file);
     // ----- Opening destination file
     if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
         $p_entry['status'] = "write_error";
         return $v_result;
     }
     // ----- Open the temporary gz file
     if (($v_src_file = @gzopen($v_gzip_temp_name, 'rb')) == 0) {
         @fclose($v_dest_file);
         $p_entry['status'] = "read_error";
         PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary read mode');
         return PclZip::errorCode();
     }
     // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
     $v_size = $p_entry['size'];
     while ($v_size != 0) {
         $v_read_size = $v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE;
         $v_buffer = @gzread($v_src_file, $v_read_size);
         //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
         @fwrite($v_dest_file, $v_buffer, $v_read_size);
         $v_size -= $v_read_size;
     }
     @fclose($v_dest_file);
     @gzclose($v_src_file);
     // ----- Delete the temporary file
     @unlink($v_gzip_temp_name);
     // ----- Return
     return $v_result;
 }
Example #23
0
 function ConnectToHost($domain, $port, $resolve_message)
 {
     if ($this->ssl) {
         $version = explode(".", function_exists("phpversion") ? phpversion() : "3.0.7");
         $php_version = intval($version[0]) * 1000000 + intval($version[1]) * 1000 + intval($version[2]);
         if ($php_version < 4003000) {
             return "establishing SSL connections requires at least PHP version 4.3.0";
         }
         if (!function_exists("extension_loaded") || !extension_loaded("openssl")) {
             return "establishing SSL connections requires the OpenSSL extension enabled";
         }
     }
     if (strlen($this->Resolve($domain, $ip, 'SMTP'))) {
         return $this->error;
     }
     if (strlen($this->socks_host_name)) {
         switch ($this->socks_version) {
             case '4':
                 $version = 4;
                 break;
             case '5':
                 $version = 5;
                 break;
             default:
                 return 'it was not specified a supported SOCKS protocol version';
                 break;
         }
         $host_ip = $ip;
         $host_port = $port;
         if (strlen($this->error = $this->Resolve($this->socks_host_name, $ip, 'SOCKS'))) {
             return $this->error;
         }
         if ($this->ssl) {
             $ip = "ssl://" . $ip;
         }
         if ($this->connection = $this->timeout ? @fsockopen($ip, $this->socks_host_port, $errno, $error, $this->timeout) : @fsockopen($ip, $this->socks_host_port, $errno)) {
             $timeout = $this->data_timeout ? $this->data_timeout : $this->timeout;
             if ($timeout && function_exists("socket_set_timeout")) {
                 socket_set_timeout($this->connection, $timeout, 0);
             }
             if (strlen($this->socks_host_name)) {
                 if ($this->debug) {
                     $this->OutputDebug('Connected to the SOCKS server ' . $this->socks_host_name);
                 }
                 $send_error = 'it was not possible to send data to the SOCKS server';
                 $receive_error = 'it was not possible to receive data from the SOCKS server';
                 switch ($version) {
                     case 4:
                         $command = 1;
                         $user = '';
                         if (!fputs($this->connection, chr($version) . chr($command) . pack('nN', $host_port, ip2long($host_ip)) . $user . Chr(0))) {
                             $error = $this->SetDataAccessError($send_error);
                         } else {
                             $response = fgets($this->connection, 9);
                             if (strlen($response) != 8) {
                                 $error = $this->SetDataAccessError($receive_error);
                             } else {
                                 $socks_errors = array("Z" => '', "[" => 'request rejected', "\\" => 'request failed because client is not running identd (or not reachable from the server)', "]" => 'request failed because client\'s identd could not confirm the user ID string in the request');
                                 $error_code = $response[1];
                                 $error = isset($socks_errors[$error_code]) ? $socks_errors[$error_code] : 'unknown';
                                 if (strlen($error)) {
                                     $error = 'SOCKS error: ' . $error;
                                 }
                             }
                         }
                         break;
                     case 5:
                         if ($this->debug) {
                             $this->OutputDebug('Negotiating the authentication method ...');
                         }
                         $methods = 1;
                         $method = 0;
                         if (!fputs($this->connection, chr($version) . chr($methods) . chr($method))) {
                             $error = $this->SetDataAccessError($send_error);
                         } else {
                             $response = fgets($this->connection, 3);
                             if (strlen($response) != 2) {
                                 $error = $this->SetDataAccessError($receive_error);
                             } elseif (Ord($response[1]) != $method) {
                                 $error = 'the SOCKS server requires an authentication method that is not yet supported';
                             } else {
                                 if ($this->debug) {
                                     $this->OutputDebug('Connecting to SMTP server IP ' . $host_ip . ' port ' . $host_port . '...');
                                 }
                                 $command = 1;
                                 $address_type = 1;
                                 if (!fputs($this->connection, chr($version) . chr($command) . "" . chr($address_type) . pack('Nn', ip2long($host_ip), $host_port))) {
                                     $error = $this->SetDataAccessError($send_error);
                                 } else {
                                     $response = fgets($this->connection, 11);
                                     if (strlen($response) != 10) {
                                         $error = $this->SetDataAccessError($receive_error);
                                     } else {
                                         $socks_errors = array("" => '', "" => 'general SOCKS server failure', "" => 'connection not allowed by ruleset', "" => 'Network unreachable', "" => 'Host unreachable', "" => 'Connection refused', "" => 'TTL expired', "" => 'Command not supported', "" => 'Address type not supported');
                                         $error_code = $response[1];
                                         $error = isset($socks_errors[$error_code]) ? $socks_errors[$error_code] : 'unknown';
                                         if (strlen($error)) {
                                             $error = 'SOCKS error: ' . $error;
                                         }
                                     }
                                 }
                             }
                         }
                         break;
                     default:
                         $error = 'support for SOCKS protocol version ' . $this->socks_version . ' is not yet implemented';
                         break;
                 }
                 if (strlen($this->error = $error)) {
                     fclose($this->connection);
                     return $error;
                 }
             }
             return '';
         }
     } elseif (strlen($this->http_proxy_host_name)) {
         if (strlen($error = $this->Resolve($this->http_proxy_host_name, $ip, 'SMTP'))) {
             return $error;
         }
         if ($this->debug) {
             $this->OutputDebug("Connecting to proxy host address \"" . $ip . "\" port " . $this->http_proxy_host_port . "...");
         }
         if ($this->connection = $this->timeout ? @fsockopen(($this->ssl ? "ssl://" : "") . $ip, $this->http_proxy_host_port, $errno, $error, $this->timeout) : @fsockopen(($this->ssl ? "ssl://" : "") . $ip, $this->http_proxy_host_port)) {
             if ($this->debug) {
                 $this->OutputDebug('Connected to HTTP proxy host "' . $this->http_proxy_host_name . '".');
             }
             $timeout = $this->data_timeout ? $this->data_timeout : $this->timeout;
             if ($timeout && function_exists("socket_set_timeout")) {
                 socket_set_timeout($this->connection, $timeout, 0);
             }
             if ($this->PutLine('CONNECT ' . $domain . ':' . $port . ' HTTP/1.0') && $this->PutLine('User-Agent: ' . $this->user_agent) && $this->PutLine('')) {
                 if (GetType($response = $this->GetLine()) == 'string') {
                     if (!preg_match('/^http\\/[0-9]+\\.[0-9]+[ \\t]+([0-9]+)[ \\t]*(.*)$/i', $response, $matches)) {
                         return $this->SetError("3 it was received an unexpected HTTP response status");
                     }
                     $error = $matches[1];
                     switch ($error) {
                         case '200':
                             for (;;) {
                                 if (GetType($response = $this->GetLine()) != 'string') {
                                     break;
                                 }
                                 if (strlen($response) == 0) {
                                     return '';
                                 }
                             }
                             break;
                         default:
                             $this->error = 'the HTTP proxy returned error ' . $error . ' ' . $matches[2];
                             break;
                     }
                 }
             }
             if ($this->debug) {
                 $this->OutputDebug("Disconnected.");
             }
             fclose($this->connection);
             $this->connection = 0;
             return $this->error;
         }
     } else {
         if ($this->debug) {
             $this->OutputDebug("Connecting to host address \"" . $ip . "\" port " . $port . "...");
         }
         if ($this->connection = $this->timeout ? @fsockopen(($this->ssl ? "ssl://" : "") . $ip, $port, $errno, $error, $this->timeout) : @fsockopen(($this->ssl ? "ssl://" : "") . $ip, $port)) {
             return "";
         }
     }
     $error = $this->timeout ? strval($error) : "??";
     switch ($error) {
         case "-3":
             return "-3 socket could not be created";
         case "-4":
             return "-4 dns lookup on hostname \"" . $domain . "\" failed";
         case "-5":
             return "-5 connection refused or timed out";
         case "-6":
             return "-6 fdopen() call failed";
         case "-7":
             return "-7 setvbuf() call failed";
     }
     return "could not connect to the host \"" . $domain . "\": " . $error;
 }
Example #24
0
 function privExtractFileUsingTempFile(&$p_entry, &$p_options)
 {
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileUsingTempFile', "filename='".$p_entry['filename']."'");
     $v_result = 1;
     // ----- Creates a temporary file
     $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.gz';
     if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) {
         fclose($v_file);
         PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary write mode');
         //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
         return PclZip::errorCode();
     }
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Start extraction of '".$p_entry['filename']."'");
     // ----- Write gz file format header
     $v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x0), time(), Chr(0x0), Chr(3));
     @fwrite($v_dest_file, $v_binary_data, 10);
     // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
     $v_size = $p_entry['compressed_size'];
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Compressed Size :".$v_size."");
     while ($v_size != 0) {
         $v_read_size = $v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE;
         //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read ".$v_read_size." bytes");
         $v_buffer = @fread($this->zip_fd, $v_read_size);
         //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
         @fwrite($v_dest_file, $v_buffer, $v_read_size);
         $v_size -= $v_read_size;
     }
     // ----- Write gz file format footer
     $v_binary_data = pack('VV', $p_entry['crc'], $p_entry['size']);
     @fwrite($v_dest_file, $v_binary_data, 8);
     // ----- Close the temporary file
     @fclose($v_dest_file);
     // ----- Opening destination file
     if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
         //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
         $p_entry['status'] = "write_error";
         //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
         return $v_result;
     }
     // ----- Open the temporary gz file
     if (($v_src_file = @gzopen($v_gzip_temp_name, 'rb')) == 0) {
         @fclose($v_dest_file);
         $p_entry['status'] = "read_error";
         PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary read mode');
         //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
         return PclZip::errorCode();
     }
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'File size is '.filesize($v_gzip_temp_name));
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");
     // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
     $v_size = $p_entry['size'];
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size :".$v_size."");
     while ($v_size != 0) {
         $v_read_size = $v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE;
         //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read ".$v_read_size." bytes");
         $v_buffer = @gzread($v_src_file, $v_read_size);
         //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
         @fwrite($v_dest_file, $v_buffer, $v_read_size);
         $v_size -= $v_read_size;
     }
     @fclose($v_dest_file);
     @gzclose($v_src_file);
     // ----- Delete the temporary file
     @unlink($v_gzip_temp_name);
     // ----- Return
     //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
     return $v_result;
 }
Example #25
0
 function DecodePart($part)
 {
     switch ($part['Type']) {
         case 'MessageStart':
             $this->headers = array();
             break;
         case 'HeaderName':
             if ($this->decode_bodies) {
                 $this->current_header = strtolower($part['Name']);
             }
             break;
         case 'HeaderValue':
             if ($this->decode_headers) {
                 $value = $part['Value'];
                 $error = '';
                 for ($decoded_header = array(), $position = 0; $position < strlen($value);) {
                     if (GetType($encoded = strpos($value, '=?', $position)) != 'integer') {
                         if ($position < strlen($value)) {
                             if (count($decoded_header)) {
                                 $decoded_header[count($decoded_header) - 1]['Value'] .= substr($value, $position);
                             } else {
                                 $decoded_header[] = array('Value' => substr($value, $position), 'Encoding' => 'ASCII');
                             }
                         }
                         break;
                     }
                     $set = $encoded + 2;
                     if (GetType($method = strpos($value, '?', $set)) != 'integer') {
                         $error = 'invalid header encoding syntax ' . $part['Value'];
                         $error_position = $part['Position'] + $set;
                         break;
                     }
                     $encoding = strtoupper(substr($value, $set, $method - $set));
                     $method += 1;
                     if (GetType($data = strpos($value, '?', $method)) != 'integer') {
                         $error = 'invalid header encoding syntax ' . $part['Value'];
                         $error_position = $part['Position'] + $set;
                         break;
                     }
                     $start = $data + 1;
                     if (GetType($end = strpos($value, '?=', $start)) != 'integer') {
                         $error = 'invalid header encoding syntax ' . $part['Value'];
                         $error_position = $part['Position'] + $start;
                         break;
                     }
                     if ($encoded > $position) {
                         if (count($decoded_header)) {
                             $decoded_header[count($decoded_header) - 1]['Value'] .= substr($value, $position, $encoded - $position);
                         } else {
                             $decoded_header[] = array('Value' => substr($value, $position, $encoded - $position), 'Encoding' => 'ASCII');
                         }
                     }
                     switch (strtolower(substr($value, $method, $data - $method))) {
                         case 'q':
                             if ($end > $start) {
                                 for ($decoded = '', $position = $start; $position < $end;) {
                                     switch ($value[$position]) {
                                         case '=':
                                             $h = HexDec($hex = strtolower(substr($value, $position + 1, 2)));
                                             if ($end - $position < 3 || strcmp(sprintf('%02x', $h), $hex)) {
                                                 $warning = 'the header specified an invalid encoded character';
                                                 $warning_position = $part['Position'] + $position + 1;
                                                 if ($this->ignore_syntax_errors) {
                                                     $this->SetPositionedWarning($warning, $warning_position);
                                                     $decoded .= '=';
                                                     $position++;
                                                 } else {
                                                     $error = $warning;
                                                     $error_position = $warning_position;
                                                     break 4;
                                                 }
                                             } else {
                                                 $decoded .= Chr($h);
                                                 $position += 3;
                                             }
                                             break;
                                         case '_':
                                             $decoded .= ' ';
                                             $position++;
                                             break;
                                         default:
                                             $decoded .= $value[$position];
                                             $position++;
                                             break;
                                     }
                                 }
                                 if (count($decoded_header) && !strcmp($decoded_header[$last = count($decoded_header) - 1]['Encoding'], 'ASCII') || !strcmp($decoded_header[$last]['Encoding'], $encoding)) {
                                     $decoded_header[$last]['Value'] .= $decoded;
                                     $decoded_header[$last]['Encoding'] = $encoding;
                                 } else {
                                     $decoded_header[] = array('Value' => $decoded, 'Encoding' => $encoding);
                                 }
                             }
                             break;
                         case 'b':
                             $decoded = base64_decode(substr($value, $start, $end - $start));
                             if ($end <= $start || GetType($decoded) != 'string' || strlen($decoded) == 0) {
                                 $warning = 'the header specified an invalid base64 encoded text';
                                 $warning_position = $part['Position'] + $start;
                                 if ($this->ignore_syntax_errors) {
                                     $this->SetPositionedWarning($warning, $warning_position);
                                 } else {
                                     $error = $warning;
                                     $error_position = $warning_position;
                                     break 2;
                                 }
                             }
                             if (count($decoded_header) && !strcmp($decoded_header[$last = count($decoded_header) - 1]['Encoding'], 'ASCII') || !strcmp($decoded_header[$last]['Encoding'], $encoding)) {
                                 $decoded_header[$last]['Value'] .= $decoded;
                                 $decoded_header[$last]['Encoding'] = $encoding;
                             } else {
                                 $decoded_header[] = array('Value' => $decoded, 'Encoding' => $encoding);
                             }
                             break;
                         default:
                             $error = 'the header specified an unsupported encoding method';
                             $error_position = $part['Position'] + $method;
                             break 2;
                     }
                     $position = $end + 2;
                 }
                 if (strlen($error) == 0 && count($decoded_header)) {
                     $part['Decoded'] = $decoded_header;
                 }
             }
             if ($this->decode_bodies || $this->decode_headers) {
                 switch ($this->current_header) {
                     case 'content-type:':
                         $boundary = $this->ParseParameters($part['Value'], $type, $parameters, 'boundary');
                         $this->headers['Type'] = $type;
                         if ($this->decode_headers) {
                             $part['MainValue'] = $type;
                             $part['Parameters'] = $parameters;
                         }
                         if (!strcmp(strtok($type, '/'), 'multipart')) {
                             $this->headers['Multipart'] = 1;
                             if (strlen($boundary)) {
                                 $this->headers['Boundary'] = $boundary;
                             } else {
                                 return $this->SetPositionedError('multipart content-type header does not specify the boundary parameter', $part['Position']);
                             }
                         }
                         break;
                     case 'content-transfer-encoding:':
                         switch ($this->headers['Encoding'] = strtolower(trim($part['Value']))) {
                             case 'quoted-printable':
                                 $this->headers['QuotedPrintable'] = 1;
                                 break;
                             case '7 bit':
                             case '8 bit':
                                 if (!$this->SetPositionedWarning('"' . $this->headers['Encoding'] . '" is an incorrect content transfer encoding type', $part['Position'])) {
                                     return 0;
                                 }
                             case '7bit':
                             case '8bit':
                             case 'binary':
                                 break;
                             case 'base64':
                                 $this->headers['Base64'] = 1;
                                 break;
                             default:
                                 if (!$this->SetPositionedWarning('decoding ' . $this->headers['Encoding'] . ' encoded bodies is not yet supported', $part['Position'])) {
                                     return 0;
                                 }
                         }
                         break;
                 }
             }
             break;
         case 'BodyStart':
             if ($this->decode_bodies && isset($this->headers['Multipart'])) {
                 $this->body_parser_state = MIME_PARSER_BODY_START;
                 $this->body_buffer = '';
                 $this->body_buffer_position = 0;
             }
             break;
         case 'MessageEnd':
             if ($this->decode_bodies && isset($this->headers['Multipart']) && $this->body_parser_state != MIME_PARSER_BODY_DONE) {
                 if ($this->body_parser_state != MIME_PARSER_BODY_DATA) {
                     return $this->SetPositionedError('incomplete message body part', $part['Position']);
                 }
                 if (!$this->SetPositionedWarning('truncated message body part', $part['Position'])) {
                     return 0;
                 }
             }
             break;
         case 'BodyData':
             if ($this->decode_bodies) {
                 if (strlen($this->body_buffer) == 0) {
                     $this->body_buffer = $part['Data'];
                     $this->body_offset = $part['Position'];
                 } else {
                     $this->body_buffer .= $part['Data'];
                 }
                 if (isset($this->headers['Multipart'])) {
                     $boundary = '--' . $this->headers['Boundary'];
                     switch ($this->body_parser_state) {
                         case MIME_PARSER_BODY_START:
                             for ($position = $this->body_buffer_position;;) {
                                 if (!$this->FindBodyLineBreak($position, $break, $line_break)) {
                                     return 1;
                                 }
                                 $next = $line_break + strlen($break);
                                 if (!strcmp(rtrim(substr($this->body_buffer, $position, $line_break - $position)), $boundary)) {
                                     $part = array('Type' => 'StartPart', 'Part' => $this->headers['Boundary'], 'Position' => $this->body_offset + $next);
                                     $this->parts[] = $part;
                                     unset($this->body_parser);
                                     $this->body_parser = new mime_parser_class();
                                     $this->body_parser->decode_bodies = 1;
                                     $this->body_parser->decode_headers = $this->decode_headers;
                                     $this->body_parser->mbox = 0;
                                     $this->body_parser_state = MIME_PARSER_BODY_DATA;
                                     $this->body_buffer = substr($this->body_buffer, $next);
                                     $this->body_offset += $next;
                                     $this->body_buffer_position = 0;
                                     break;
                                 } else {
                                     $position = $next;
                                 }
                             }
                         case MIME_PARSER_BODY_DATA:
                             for ($position = $this->body_buffer_position;;) {
                                 if (!$this->FindBodyLineBreak($position, $break, $line_break)) {
                                     if ($position > 0) {
                                         if (!$this->body_parser->Parse(substr($this->body_buffer, 0, $position), 0)) {
                                             return $this->SetError($this->body_parser->error);
                                         }
                                         if (!$this->QueueBodyParts()) {
                                             return 0;
                                         }
                                     }
                                     $this->body_buffer = substr($this->body_buffer, $position);
                                     $this->body_buffer_position = 0;
                                     $this->body_offset += $position;
                                     return 1;
                                 }
                                 $next = $line_break + strlen($break);
                                 $line = substr($this->body_buffer, $position, $line_break - $position);
                                 if (!strcmp(rtrim($line), $boundary)) {
                                     if (!$this->body_parser->Parse(substr($this->body_buffer, 0, $position), 1)) {
                                         return $this->SetError($this->body_parser->error);
                                     }
                                     if (!$this->QueueBodyParts()) {
                                         return 0;
                                     }
                                     $part = array('Type' => 'EndPart', 'Part' => $this->headers['Boundary'], 'Position' => $this->body_offset + $position);
                                     $this->parts[] = $part;
                                     $part = array('Type' => 'StartPart', 'Part' => $this->headers['Boundary'], 'Position' => $this->body_offset + $next);
                                     $this->parts[] = $part;
                                     unset($this->body_parser);
                                     $this->body_parser = new mime_parser_class();
                                     $this->body_parser->decode_bodies = 1;
                                     $this->body_parser->decode_headers = $this->decode_headers;
                                     $this->body_parser->mbox = 0;
                                     $this->body_buffer = substr($this->body_buffer, $next);
                                     $this->body_buffer_position = 0;
                                     $this->body_offset += $next;
                                     $position = 0;
                                     continue;
                                 } elseif (!strcmp($r = rtrim($line), $boundary . '--')) {
                                     if (!$this->body_parser->Parse(substr($this->body_buffer, 0, $position), 1)) {
                                         return $this->SetError($this->body_parser->error);
                                     }
                                     if (!$this->QueueBodyParts()) {
                                         return 0;
                                     }
                                     $part = array('Type' => 'EndPart', 'Part' => $this->headers['Boundary'], 'Position' => $this->body_offset + $position);
                                     $this->body_buffer = substr($this->body_buffer, $next);
                                     $this->body_buffer_position = 0;
                                     $this->body_offset += $next;
                                     $this->body_parser_state = MIME_PARSER_BODY_DONE;
                                     break 2;
                                 }
                                 $position = $next;
                             }
                             break;
                         case MIME_PARSER_BODY_DONE:
                             return 1;
                         default:
                             return $this->SetPositionedError($this->state . ' is not a valid body parser state', $this->body_buffer_position);
                     }
                 } elseif (isset($this->headers['QuotedPrintable'])) {
                     for ($end = strlen($this->body_buffer), $decoded = '', $position = $this->body_buffer_position; $position < $end;) {
                         if (GetType($equal = strpos($this->body_buffer, '=', $position)) != 'integer') {
                             $decoded .= substr($this->body_buffer, $position);
                             $position = $end;
                             break;
                         }
                         $next = $equal + 1;
                         switch ($end - $equal) {
                             case 1:
                                 $decoded .= substr($this->body_buffer, $position, $equal - $position);
                                 $position = $equal;
                                 break 2;
                             case 2:
                                 $decoded .= substr($this->body_buffer, $position, $equal - $position);
                                 if (!strcmp($this->body_buffer[$next], "\n")) {
                                     $position = $end;
                                 } else {
                                     $position = $equal;
                                 }
                                 break 2;
                         }
                         if (!strcmp(substr($this->body_buffer, $next, 2), $break = "\r\n") || !strcmp($this->body_buffer[$next], $break = "\n") || !strcmp($this->body_buffer[$next], $break = "\r")) {
                             $decoded .= substr($this->body_buffer, $position, $equal - $position);
                             $position = $next + strlen($break);
                             continue;
                         }
                         $decoded .= substr($this->body_buffer, $position, $equal - $position);
                         $h = HexDec($hex = strtolower(substr($this->body_buffer, $next, 2)));
                         if (strcmp(sprintf('%02x', $h), $hex)) {
                             if (!$this->SetPositionedWarning('the body specified an invalid quoted-printable encoded character', $this->body_offset + $next)) {
                                 return 0;
                             }
                             $decoded .= '=';
                             $position = $next;
                         } else {
                             $decoded .= Chr($h);
                             $position = $equal + 3;
                         }
                     }
                     if (strlen($decoded) == 0) {
                         $this->body_buffer_position = $position;
                         return 1;
                     }
                     $part['Data'] = $decoded;
                     $this->body_buffer = substr($this->body_buffer, $position);
                     $this->body_buffer_position = 0;
                     $this->body_offset += $position;
                 } elseif (isset($this->headers['Base64'])) {
                     $part['Data'] = base64_decode($this->body_buffer_position ? substr($this->body_buffer, $this->body_buffer_position) : $this->body_buffer);
                     $this->body_offset += strlen($this->body_buffer) - $this->body_buffer_position;
                     $this->body_buffer_position = 0;
                     $this->body_buffer = '';
                 } else {
                     $part['Data'] = substr($this->body_buffer, $this->body_buffer_position);
                     $this->body_buffer_position = 0;
                     $this->body_buffer = '';
                 }
             }
             break;
     }
     $this->parts[] = $part;
     return 1;
 }
Example #26
0
 function setContent($content)
 {
     $content = $this->setAtUsersLink($content);
     $check_content = $content;
     for ($i = 10; $i < 14; $i++) {
         $check_content = str_replace(Chr($i), '', $check_content);
     }
     $contentLength = strlen(trim($check_content));
     $minLength = empty($this->threadMinLength) ? $this->postmin : $this->threadMinLength;
     if ($contentLength >= $this->postmax || $contentLength < $minLength) {
         if (empty($this->threadMinLength)) {
             return $this->post->showmsg('postfunc_content_limit');
         }
         $GLOBALS['contentMinLength'] = $this->threadMinLength;
         return $this->post->showmsg('postfunc_content_threadlimit');
     }
     if (!$this->post->isGM && (!$this->forum->foruminfo['allowhide'] || !$this->post->_G['allowhidden']) && strpos($content, "[post") !== false && strpos($content, "[/post]") !== false) {
         Showmsg('post_limit_hide');
     }
     if (!$this->post->isGM && (!$this->forum->foruminfo['allowsell'] || !$this->post->_G['allowsell']) && strpos($content, '[sell') !== false && strpos($content, '[/sell]') !== false) {
         Showmsg('post_limit_sell');
     }
     if (preg_match_all('/\\[sell=([\\d]+?)(,[\\w]+)?\\]([^\\x00]*?)\\[\\/sell\\]/', $content, $sellList)) {
         $sellMax = max($sellList[1]);
         if ($GLOBALS['db_sellset']['price'] && (int) $sellMax > $GLOBALS['db_sellset']['price']) {
             return false;
         }
         $content = preg_replace('/\\[sell=([\\d]+)/', "[sell={$sellMax}", $content);
     }
     /*
     		 if (($GLOBALS['banword'] = $this->wordsfb->comprise($content, false)) !== false) {
     return $this->post->showmsg('content_wordsfb');
     }
     */
     $this->data['content'] = $content;
     return true;
 }
Example #27
0
function DoQuery()
{
    global $cnInfoCentral;
    global $aRowClass;
    global $rsQueryResults;
    global $qry_SQL;
    global $iQueryID;
    //Run the SQL
    $rsQueryResults = RunQuery($qry_SQL);
    //Set the first row style
    $sRowClass = "RowColorA";
    //Check for a count display
    DisplayRecordCount();
    //Start the table and the header row
    echo "<table align=\"center\" cellpadding=\"5\" cellspacing=\"0\">";
    echo "<tr class=\"TableHeader\">";
    //Loop through the fields and write the header row
    for ($iCount = 0; $iCount < mysql_num_fields($rsQueryResults); $iCount++) {
        //If this field is called "AddToCart", don't display this field...
        if (mysql_field_name($rsQueryResults, $iCount) != "AddToCart") {
            echo "<td>" . mysql_field_name($rsQueryResults, $iCount) . "</td>";
        }
    }
    //Close the header row
    echo "</tr>";
    $aHiddenFormField = array();
    //Loop through the recordset
    while ($aRow = mysql_fetch_array($rsQueryResults)) {
        //Alternate the background color of the row
        $sRowClass = AlternateRowStyle($sRowClass);
        //Begin the row
        echo "<tr class=\"" . $sRowClass . "\">";
        //Loop through the fields and write each one
        for ($iCount = 0; $iCount < mysql_num_fields($rsQueryResults); $iCount++) {
            //If this field is called "AddToCart", add this to the hidden form field...
            if (mysql_field_name($rsQueryResults, $iCount) == "AddToCart") {
                $aHiddenFormField[] = $aRow[$iCount];
            } else {
                //Write the actual value of this row
                echo "<td>" . $aRow[$iCount] . "&nbsp;</td>";
            }
        }
        //Close the row
        echo "</tr>";
    }
    //Close the table and allow a link to run the query again
    echo "</table>";
    echo "<p align=\"center\">";
    if (count($aHiddenFormField) > 0) {
        ?>
		<form method="post" action="CartView.php"><p align="center">
			<input type="hidden" value="<?php 
        echo join(",", $aHiddenFormField);
        ?>
" name="BulkAddToCart">
			<input type="submit" class="icButton" name="AddToCartSubmit" value="<?php 
        echo gettext("Add Results To Cart");
        ?>
">&nbsp;
			<input type="submit" class="icButton" name="AndToCartSubmit" value="<?php 
        echo gettext("Intersect Results With Cart");
        ?>
">&nbsp;
			<input type="submit" class="icButton" name="NotToCartSubmit" value="<?php 
        echo gettext("Remove Results From Cart");
        ?>
">
		</p></form>
		<?php 
    }
    echo "<p align=\"center\"><a href=\"QueryView.php?QueryID=" . $iQueryID . "\">" . gettext("Run Query Again") . "</a></p>";
    echo "<p align=\"center\"><a href=\"QueryList.php\">" . gettext("Return to Query Menu") . "</a></p>";
    //Print the SQL to make debugging easier
    echo "<br><p class=\"ShadedBox\"><span class=\"SmallText\">" . str_replace(Chr(13), "<br>", htmlspecialchars($qry_SQL)) . "</span></p>";
}
         // Password
         $password = "";
         for ($i = 0; $i < 10; $i++) {
             // Pick random number between 1 and 62
             $randomNumber = rand(1, 62);
             // Select random character based on mapping.
             if ($randomNumber < 11) {
                 // [ 1,10] => [0,9]
                 $password .= Chr($randomNumber + 48 - 1);
             } else {
                 if ($randomNumber < 37) {
                     // [11,36] => [A,Z]
                     $password .= Chr($randomNumber + 65 - 10);
                 } else {
                     // [37,62] => [a,z]
                     $password .= Chr($randomNumber + 97 - 36);
                 }
             }
         }
         $message = "Created user name is '{$username}'.";
         $mysqli->query("Insert into sp_users (username, pass, email1) values ('{$username}', '{$password}', '{$email}');");
         $result3 = $mysqli->query("Select userno From sp_users Where username='******'");
         $row = $result3->fetch_row();
         $userno = $row[0];
         // Send welcome email
         $mail = "\nWelcome to 21.180 Commander\n\nYour details are\nUsername: {$username}\nPassword: {$password}\nEmail   : {$email}\n\n\nYou can access the game at http:\\game.asup.co.uk\n\nPlease check/change your details in the Profile section, then feel free\nto enter a game queue.  You will then be notified when your game is ready.\n\nDocumentation is available on-line, but I assume that you have a basic\nunderstanding of the rules, and there are still things that need adding in\nso if you have any questions please feel free to ask.\n\nRules are (approximately) v3.0 with a few necessary tweeks for the automation\nand local rule changes.\n\nPlease get in touch via suprem@asup.co.uk if you have any comments, queries\nor encounter any problems...\n";
         utl_mail(0, $userno, $mail);
         $result3->close();
         echo "Email for <strong>{$username}</strong> sent to <em>{$_POST['email']}</em>.";
     }
 }
function oos_get_random_picture_name($length = 24)
{
    $sStr = "";
    for ($index = 1; $index <= $length; $index++) {
        // Pick random number between 1 and 62
        $randomNumber = rand(1, 62);
        // Select random character based on mapping.
        if ($randomNumber < 11) {
            $sStr .= Chr($randomNumber + 48 - 1);
            // [ 1,10] => [0,9]
        } else {
            if ($randomNumber < 37) {
                $sStr .= Chr($randomNumber + 65 - 10);
                // [11,36] => [A,Z]
            } else {
                $sStr .= Chr($randomNumber + 97 - 36);
                // [37,62] => [a,z]
            }
        }
    }
    return $sStr;
}
/**
* send_remindpass
* 
* sends an e-mail to the user with new generated password or
* if errors occurred then saves errors to the $site->fdat['form_error'] array.
* Requires: GET/POST parameter "op2" must be "send", is step 2 after #remind password# form
* 
* @package CMS
* 
* usage:	include_once($class_path."login_html.inc.php");
*			send_remindpass(array("site" => $this));
*/
function send_remindpass() {
	$args = func_get_arg(0);
	$site = &$args['site']; # pointer to site instance
	# check if feature is allowed: 
	if(!$site->CONF['allow_forgot_password']){ return; }

	#########################
	# STEP 2 => SEND E-MAIL
	if($site->fdat['op2'] == 'send') {

	##### emaili formaadi kontroll
	if (!preg_match("/^[\w\-\&\.\d]+\@[\w\-\&\.\d]+$/", $site->fdat['email'])) {
		$op2_status = "error";
		$site->fdat['form_error']['email'] = $site->sys_sona(array(sona => "wrong email format", tyyp=>"kasutaja"));
	}
	#### if no errors
	if ($op2_status != "error") {

		###### check if user exists
		$sql = $site->db->prepare("SELECT user_id, firstname,lastname,username,email,is_readonly FROM users WHERE email LIKE ? ", $site->fdat['email']);
#		print $sql;
		$sth = new SQL($sql);
		$site->debug->msg($sth->debug->get_msgs());
		$user = $sth->fetch();	
#		printr($user);
#		exit;

		##### exactly 1 user found => OK
		if ($sth->rows == 1 && $user['is_readonly']!=1) {
			# data sanity: if account info exists => OK
			if($user['username']){ 
	
			######## always GENERATE NEW PASSWORD
			$new_pass = genpassword(8); # length 8 char
			# then encrypt password
			$enc_new_pass = crypt($new_pass, Chr(rand(65,91)).Chr(rand(65,91)));
		
			########## CHANGE password
			$sql = $site->db->prepare("UPDATE users SET password=? WHERE user_id=? ", $enc_new_pass, $user['user_id']);
#			print $sql;
			$sth = new SQL($sql);		

			########## SEND email
			$header = "<br>";
			$footer = "<br>____________________________________<br>
			".$site->CONF["site_name"]."<br>
			".(empty($_SERVER['HTTPS']) ? 'http://' : 'https://').$site->CONF["hostname"].$site->CONF["wwwroot"]."/";

			/*
			$headers  = "MIME-Version: 1.0\r\n";
			$headers .= "Content-type: text/html; charset=".$site->encoding."\r\n";
			$headers .= "From: ".$site->CONF["from_email"]."\r\n";
			*/

$message .= "
".$site->sys_sona(array(sona => "Name", tyyp=>"Admin")).": ".$user['firstname']." ".$user['lastname']."<br>
".$site->sys_sona(array(sona => "Username", tyyp=>"Admin")).": ".$user['username']."<br>
".$site->sys_sona(array(sona => "Password", tyyp=>"Admin")).": ".$new_pass."<br>
";

$message .= '<br>'.$site->sys_sona(array(sona => "forgotten password: mail body", tyyp=>"kasutaja")).'<br>';

			global $class_path;
			include_once($class_path.'mail.class.php');

			$mail = new email(array(
		  		'subject' => $site->sys_sona(array('sona' => 'unustatud parool: subject', 'tyyp' => 'kasutaja')),
		  		'message' => strip_tags($header.$message.$footer),
		  		'html' => $header.$message.$footer,
		  		'charset' => $site->encoding,
		  	));
		  	
		  	$send_status = $mail->send_mail(array(
		  		'to' => $user['email'],
		  		'from' => $site->CONF['from_email'],
		  	));

			//$send_status = mail ($user['email'],$site->sys_sona(array(sona => "unustatud parool: subject", tyyp=>"kasutaja")), $header.$message.$footer, $headers);

			######## MAIL OK
			if ($send_status) { 
				new Log(array(
					'action' => 'send',
					'component' => 'Users',
					'message' => "Password reminder: e-mail sent to '".$user['email']."'.",
				));
				$op2_status = "ok";			
			}
			######## MAIL ERROR
			else  { 
				new Log(array(
					'action' => 'send',
					'component' => 'Users',
					'type' => 'ERROR',
					'message' => "Password reminder error: can't send e-mail to '".$user['email']."'.",
				));
				$op2_status = "error";
				$site->fdat['form_error']['email'] = $site->sys_sona(array(sona => "viga", tyyp=>"kujundus"));			
			} 

			} # if account info exists
			# if no username found => error
			else {
				new Log(array(
					'action' => 'send',
					'component' => 'Users',
					'type' => 'ERROR',
					'message' => "Password reminder error: user with e-mail '".$site->fdat['email']."' doesn't have username.",
				));
				$op2_status = "error";
				$site->fdat['form_error']['email'] = $site->sys_sona(array(sona => "email not found", tyyp=>"kasutaja"));	
			}
		} # exactly 1 user found 
		else {
				# 0) the User is flagged is_readonly => write log message
			if($user['is_readonly']==1){
					new Log(array(
						'action' => 'send',
						'component' => 'Users',
						'type' => 'ERROR',
						'message' => "Password reminder error: the email '".$site->fdat['email']."' belongs to a is_readonly flagged user, so no password was sent.",
					));
			}else{
				# 1) if more than 1 users found => write log message
				if($sth->rows > 1) { 
					new Log(array(
						'action' => 'send',
						'component' => 'Users',
						'type' => 'ERROR',
						'message' => "Password reminder error: more than 1 user found with  e-mail '".$site->fdat['email']."'.",
					));
				}
				# 2) if no users found => write log message and give error message
				else {
					new Log(array(
						'action' => 'send',
						'component' => 'Users',
						'type' => 'ERROR',
						'message' => "Password reminder error: no user found with e-mail '".$site->fdat['email']."'.",
					));
				}
			}
			$op2_status = "error";
			$site->fdat['form_error']['email'] = $site->sys_sona(array(sona => "email not found", tyyp=>"kasutaja"));	
		} # how many users found
	} # email is ok
	} # op2
	# / STEP 2 => SEND
	#########################

	return $site->fdat['form_error'];
}