Esempio n. 1
0
function _gs_utf8_get_map()
{
    $map = array();
    $lines = @file(dirName(__FILE__) . '/Translit.txt');
    if (!is_array($lines)) {
        return $map;
    }
    foreach ($lines as $line) {
        $line = trim($line);
        if ($line == '' || subStr($line, 0, 1) == '#') {
            continue;
        }
        $tmp = explode(';', $line, 3);
        $char = rTrim(@$tmp[0]);
        $translit = trim(@$tmp[1]);
        if (!$translit) {
            $map[$char] = '';
        } else {
            $char = hexUnicodeToUtf8($char);
            $tmp = @preg_split('/\\s+/S', $translit);
            if (!is_array($tmp)) {
                continue;
            }
            $t = '';
            foreach ($tmp as $translit) {
                $t .= hexUnicodeToUtf8($translit);
            }
            $map[$char] = $t;
        }
    }
    return $map;
}
Esempio n. 2
0
function inherit_chk($element, $settings_array, $skin)
{
    $get_skin_data = maybe_unserialize(get_option('skin_data_' . $skin));
    $settings_array = explode(",", $settings_array);
    $is_inherited = '';
    foreach ($settings_array as $chk) {
        if (isset($get_skin_data['skin_id_' . $chk . '_inherit'])) {
            $chk_element = stripslashes(htmlspecialchars($get_skin_data['skin_id_' . $chk . '_inherit']));
        } else {
            $chk_element = '';
        }
        if ($chk_element == $element) {
            $is_inherited .= $chk . ',';
        }
    }
    return rTrim($is_inherited, ',');
}
        psetting('P399', 'German');
        # language file prefix ( e.g. german => gxp_german.lpf, maxlength 32 )
    } else {
        psetting('P342', '0');
        # display language ( 0 = english, 2 = chinese, 3 = P399 )
        psetting('P399', '');
        # language file prefix ( e.g. german => gxp_german.lpf, maxlength 32 )
    }
}
#####################################################################
#  Screen Saver (GXV) (global)
#####################################################################
if (in_array($phone_model, array('gxv3000', 'gxv3005'), true)) {
    psetting('P933', '0');
    # Enable Screen Saver Download ( 0 = disable, 1 = http, 2 = tftp )
    psetting('P934', rTrim(str_replace(GS_PROV_SCHEME . '://', '', $prov_url_grandstream), '/'));
    # Screen Saver Download server path ( maxlength 128 )
    # grandstream automatically adds "/image.bin" to the URL
    # e.g. prov/grandstream/image.bin
}
#####################################################################
#  Network Screen Saver (GXV) (global)
#####################################################################
if (in_array($phone_model, array('gxv3000', 'gxv3005'), true)) {
    psetting('P943', '0');
    # Enable Network Screen Saver Download ( 0 = disable, 1 = http )
    psetting('P942', '');
    # Network Screen Saver Download server path ( maxlength 128 )
}
#####################################################################
#  Weather Forecast (GXV) (global)
Esempio n. 4
0
}
if ($mac === '000000000000') {
    gs_log(GS_LOG_NOTICE, "Snom M3 provisioning: Invalid MAC address \"{$mac}\" (huh?)");
    # don't explain this to the users
    _settings_err('No! See log for details.');
}
# make sure the phone is a Snom-M3:
#
if (subStr($mac, 0, 6) !== '000413' && subStr($mac, 0, 6) !== '00087B') {
    gs_log(GS_LOG_NOTICE, "Snom M3 provisioning: MAC address \"{$mac}\" is not a Snom M3 phone");
    # don't explain this to the users
    _settings_err('No! See log for details.');
}
$ua = trim(@$_SERVER['HTTP_USER_AGENT']);
if (preg_match('/^Mozilla\\/\\d\\.\\d\\s*\\(compatible;\\s*/i', $ua, $m)) {
    $ua = rTrim(subStr($ua, strLen($m[0])), ' )');
}
gs_log(GS_LOG_DEBUG, "Snom model {$ua} found.");
if (preg_match('/snom-m3/i', $ua, $m)) {
    $phone_model = 'm3';
} else {
    $phone_model = 'unknown';
}
$phone_type = 'snom-' . $phone_model;
# e.g. "snom-m3"
# to be used when auto-adding the phone
$fw_vers = preg_match('/snom-m3-SIP\\/(\\d+\\.\\d+)/', $ua, $m) ? $m[1] : '0.0';
$fw_vers_nrml = _snom_normalize_version($fw_vers);
gs_log(GS_LOG_DEBUG, "Snom phone \"{$mac}\" asks for settings (UA: ...\"{$ua}\") - model: {$phone_model}");
require_once GS_DIR . 'inc/db_connect.php';
require_once GS_DIR . 'inc/nobody-extensions.php';
Esempio n. 5
0
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
\*******************************************************************/
defined('GS_VALID') or die('No direct access.');
include_once GS_DIR . 'inc/util.php';
include_once GS_DIR . 'inc/gs-fns/gs_callforward_get.php';
include_once GS_DIR . 'inc/gs-fns/gs_prov_phone_checkcfg.php';
include_once GS_DIR . 'inc/gs-fns/gs_user_comment_get.php';
include_once GS_DIR . 'inc/gs-fns/gs_user_comment_set.php';
$action = array_key_exists('action', $_REQUEST) ? $_REQUEST['action'] : '';
if (!@$_SESSION['sudo_user']['info']['host_is_foreign']) {
    if ($action === 'reboot') {
        gs_prov_phone_checkcfg_by_ext($_SESSION['sudo_user']['info']['ext'], true);
    } elseif ($action === 'setcomment') {
        $comment = rTrim(mb_subStr(trim(@$_REQUEST['comment']), 0, 200));
        gs_user_comment_set($_SESSION['sudo_user']['name'], $comment);
    }
}
echo '<h2>';
if (@$MODULES[$SECTION]['icon']) {
    echo '<img alt=" " src="', GS_URL_PATH, str_replace('%s', '32', $MODULES[$SECTION]['icon']), '" /> ';
}
if (count($MODULES[$SECTION]['sub']) > 1) {
    echo $MODULES[$SECTION]['title'], ' - ';
}
echo $MODULES[$SECTION]['sub'][$MODULE]['title'];
echo '</h2>', "\n";
//echo '<br />', "\n";
echo '<h2>', __('Willkommen'), ', ', htmlEnt($_SESSION['sudo_user']['info']['firstname'] . ' ' . $_SESSION['sudo_user']['info']['lastname']), '!</h2>', "\n";
if ($_SESSION['sudo_user']['name'] === 'sysadmin') {
Esempio n. 6
0
    echo $MODULES[$SECTION]['title'], ' - ';
}
echo $MODULES[$SECTION]['sub'][$MODULE]['title'];
echo '</h2>', "\n";
echo '<h3>Interfaces</h3>', "\n";
$etc_network_interfaces = '/etc/network/interfaces';
if (!file_exists($etc_network_interfaces)) {
    echo "File \"{$etc_network_interfaces}\" not found.\n";
} else {
    $file = @file($etc_network_interfaces);
    if (empty($file)) {
        echo "Failed to read \"{$etc_network_interfaces}\".\n";
    } else {
        $out = '';
        foreach ($file as $line) {
            $line = rTrim($line);
            if (trim($line) == '') {
                continue;
            }
            if (preg_match('/^\\s*#/S', $line)) {
                continue;
            }
            if (preg_match('/^\\s+/S', $line, $m)) {
                $indent = '&nbsp;&nbsp;&nbsp; ';
                $line = subStr($line, strLen($m[0]));
            } else {
                $indent = '';
            }
            $out .= $indent . htmlEnt($line) . "\n";
        }
        echo '<pre>', "\n";
Esempio n. 7
0
} elseif ($NV_datasource == "data-4") {
    include NV_FILES . '/inc/classes/slideset-class.php';
}
$slidenum_chk = $postcount;
if (!empty($post_count)) {
    $slidenum_chk = $post_count;
}
$postcount = 0;
echo '</div><!-- / slider-inner-wrap -->';
echo '</div><!-- / stageslider -->';
if ($NV_show_slider == 'islider') {
    // iSlider Image Nav
    if (!empty($NV_imgheight)) {
        $NV_navimg_height = $NV_imgheight / 3 + 1;
    }
    $NV_navimg = rTrim($NV_navimg, ',');
    $NV_navimg = explode(',', $NV_navimg);
    $params = '';
    $params['width'] = $NV_navimg_width;
    if (!empty($NV_navimg_height)) {
        $params['height'] = $NV_navimg_height;
    }
    $params['crop'] = true;
    echo '<div class="islider-nav-wrap">';
    echo '<div class="nvcolor-wrap">';
    echo '<span class="nvcolor"></span>';
    echo '<div class="nav-prev islider-nav"></div>';
    echo '</div>';
    echo '<ul class="islider-nav-ul" style="height:' . $NV_imgheight . 'px">';
    echo '<li class="copynav">';
    echo '<ul>';
Esempio n. 8
0
# needs to be passed by reference
stream_set_blocking($pipes[1], true);
while (true) {
    $agi_cmd_line = '';
    $i = 0;
    while (true) {
        if (fEof($pipes[1])) {
            # AGI script exited
            break 2;
        }
        if (stream_select($select, $null, $null, 1) > 0) {
            $agi_cmd_line .= fGetS($pipes[1], 8192);
            if (subStr($agi_cmd_line, -1) === "\n") {
                # end of line
                //$agi_cmd_line = subStr($agi_cmd_line,0,-1);
                $agi_cmd_line = rTrim($agi_cmd_line);
                break;
            }
        }
        if (++$i > 2) {
            # 1 s * 10 = 10 s
            gs_log(GS_LOG_WARNING, 'Timeout while waiting for AGI command.');
            echo "### Timeout while waiting for AGI command. Buffer is \"{$agi_cmd_line}\".\n";
            //echo "### ". (int)fEof($pipes[1]) ."\n";
            if ($agi_cmd_line === '') {
                $agi_cmd_line = false;
            }
            exit(1);
            break;
        }
    }
Esempio n. 9
0
function gs_agi_read_line()
{
    $buf = '';
    $i = 0;
    $select = array(STDIN);
    # needs to be passed by reference
    $null = null;
    # needs to be passed by reference
    stream_set_blocking(STDIN, true);
    stream_set_timeout(STDIN, 1);
    while (true) {
        if (stream_select($select, $null, $null, 0, 500000) > 0) {
            $buf .= fGetS(STDIN, 8192);
            if (subStr($buf, -1) === "\n") {
                # end of line
                //$buf = subStr($buf,0,-1);
                $buf = rTrim($buf);
                break;
            }
        }
        if (++$i > 10) {
            # 500000 us * 10 = 5 s
            gs_agi_log(GS_LOG_WARNING, "Timeout while waiting for input. Buffer is \"{$buf}\".");
            if ($buf === '') {
                return false;
            }
            break;
        }
    }
    //gs_agi_log( GS_LOG_DEBUG, "LINE: $buf (".strLen($buf).")" );
    return $buf;
}
Esempio n. 10
0
         $str = "\n[" . $key . ']' . $val;
     }
     //add headig line
     if ($cnt == 1) {
         if ($ext == 'otf') {
             $str = '#Dircaster templete override file ' . basename($f) . $str;
         } else {
             $str = '#Dircaster override file ' . basename($f) . $str;
         }
     }
     // effects fwrite as well as db inserts
     if (get_magic_quotes_gpc()) {
         $str = stripslashes($str);
     }
     $cnt++;
     if (!fwrite($fp, rTrim($str, "\n"))) {
         $msg = 'Failure, could write to file:';
         $aJ['msg'] = $msg;
         echo json_encode($aJ);
     } else {
         $msg = 'Success writing:';
         $pi = pathInfo($f);
         $aJ['option'] = '<option value="' . $pi['filename'] . '">' . $pi['filename'] . '</option>';
         $aTmp = pathinfo($_SERVER['HTTP_REFERER']);
         $aHref = $aTmp['dirname'];
         $nf = ltrim($f, '.');
         $nf = ltrim($nf, '/');
         $fl = '<a href="' . $aHref . '/' . $nf . '" class="view-' . $vSufix . '" target="_blank" title="View new/revised file in browser.">' . 'View file</a>';
         $aJ['link'] = $fl;
     }
 }
Esempio n. 11
0
function postgallery_image_shortcode($atts, $content = null, $code)
{
    extract(shortcode_atts(array('content' => '', 'categories' => '', 'post_format' => '', 'product_categories' => '', 'product_tags' => '', 'slidesetid' => '', 'attached_id' => '', 'pagepost_id' => '', 'media_categories' => '', 'portfolio_categories' => '', 'flickr_set' => '', 'imageeffect' => '', 'shadow' => '', 'timeout' => '', 'lightbox' => '', 'playnav' => '', 'navigation' => '', 'height' => '', 'width' => '1140', 'title' => '', 'align' => '', 'id' => '', 'limit' => '', 'orderby' => '', 'sortby' => '', 'animation' => '', 'tween' => '', 'speed' => '', 'excerpt' => '', 'customlayer' => '', 'data_source' => ''), $atts));
    /* ------------------------------------
    		:: SET VARIABLES
    		------------------------------------*/
    $NV_shortcode_id = "sg" . esc_attr($id);
    $NV_gallerycat = esc_attr($categories);
    $NV_gallerypostformat = esc_attr($post_format);
    $NV_mediacat = esc_attr($media_categories);
    if (!empty($portfolio_categories)) {
        $NV_mediacat = esc_attr($portfolio_categories);
    }
    $NV_slidesetid = esc_attr($slidesetid);
    $NV_attachedmedia = esc_attr($attached_id);
    $NV_flickrset = esc_attr($flickr_set);
    $NV_productcat = esc_attr($product_categories);
    $NV_producttag = esc_attr($product_tags);
    $NV_pagepost_id = esc_attr($pagepost_id);
    /* ------------------------------------
    		:: SET VARIABLES *END*
    		------------------------------------*/
    $NV_show_slider = '';
    if ($code == 'postgallery_image') {
        $NV_show_slider = 'stageslider';
    } elseif ($code == 'postgallery_islider') {
        $NV_show_slider = 'islider';
    } elseif ($code == 'postgallery_nivo') {
        $NV_show_slider = 'nivo';
    }
    $NV_gallery_format = '';
    $NV_speed = esc_attr($speed);
    $NV_customlayer = esc_attr($customlayer);
    $NV_title = esc_attr($title);
    $NV_lightbox = esc_attr($lightbox);
    $NV_slidesetid = esc_attr($slidesetid);
    $NV_stageplaypause = esc_attr($playnav);
    $NV_stageplaypause = esc_attr($navigation);
    if (esc_attr($excerpt)) {
        $NV_galleryexcerpt = esc_attr($excerpt);
    } else {
        $NV_galleryexcerpt = "55";
    }
    if (esc_attr($animation)) {
        $NV_animation = esc_attr($animation);
    } else {
        if ($NV_show_slider == 'nivo') {
            $NV_animation = "random";
        } else {
            $NV_animation = "fade";
        }
    }
    if (esc_attr($tween)) {
        $NV_tween = esc_attr($tween);
    } else {
        $NV_tween = "linear";
    }
    $NV_imgwidth = esc_attr($width);
    $NV_imgheight = esc_attr($height);
    $NV_galleryheight = $NV_imgheight;
    $NV_imageeffect = esc_attr($imageeffect);
    $NV_gallery_width = $NV_imgwidth;
    $NV_gallerysortby = esc_attr($sortby);
    $NV_galleryorderby = esc_attr($orderby);
    $NV_gallerynumposts = esc_attr($limit);
    if ($NV_imgwidth && !$NV_imgheight) {
        $NV_image_size = "w=" . $NV_imgwidth . "&amp;";
    } elseif ($NV_imgheight && !$NV_imgwidth) {
        $NV_image_size = "h=" . $NV_imgheight . "&amp;";
    } elseif ($NV_imgheight && $NV_imgwidth) {
        $NV_image_size = "w=" . $NV_imgwidth . "&amp;h=" . $NV_imgheight . "&amp;";
    }
    if ($NV_show_slider == 'nivo' && !$NV_imgheight) {
        $NV_galleryheight = $NV_imgheight = '350';
        $NV_image_size = "w=" . $NV_imgwidth . "&amp;h=" . $NV_imgheight . "&amp;";
    }
    if ($NV_show_slider == 'stageslider') {
        // Set the Gallery Type
        $NV_gallery_type = 'stage-slider';
    } elseif ($NV_show_slider == 'islider') {
        $NV_gallery_type = 'stage-slider islider id' . $NV_shortcode_id;
    } elseif ($NV_show_slider == 'nivo') {
        $NV_gallery_type = 'stage-slider-nivo id' . $NV_shortcode_id;
    }
    if ($NV_show_slider == 'islider') {
        // iSlider Vars
        $NV_navimg_width = $NV_imgwidth / 100 * 25;
        $NV_gallery_width = $NV_imgwidth + $NV_navimg_width;
        $NV_gallery_format = 'style="float:left;"';
        $NV_gallery_effect = $NV_imageeffect . ' islider';
        $NV_imageeffect = $NV_gallery_extras = '';
        $NV_gallerywrap_style = 'max-width:' . $NV_imgwidth . 'px;';
    }
    if ($NV_show_slider == 'nivo') {
        // Nivo Slider Vars
        $NV_gallery_format = 'style="max-width:' . $NV_imgwidth . 'px"';
        $NV_gallerywrap_style = 'max-width:' . $NV_gallery_width . 'px';
        $NV_gallery_effect = $NV_imageeffect . ' nivo';
        $NV_imageeffect = $NV_gallery_extras = '';
        $NV_stagetransition = !empty($NV_nivoeffect) ? $NV_nivoeffect : 'random';
        $NV_stagetimeout = empty($NV_stagetimeout) ? $NV_stagetimeout = 10000 : ($NV_stagetimeout = $NV_stagetimeout * 1000);
    }
    if ($NV_show_slider == 'stageslider') {
        // Stage Slider Vars
        $NV_gallerywrap_style = 'max-width:' . $NV_gallery_width . 'px';
        $NV_gallery_effect = ' stage';
        $NV_gallery_extras = 'style="height:' . $NV_galleryheight . 'px;"';
        $NV_gallery_format = '';
    }
    if (esc_attr($timeout)) {
        $NV_stagetimeout = esc_attr($timeout);
    }
    ob_start();
    if (!empty($NV_title)) {
        echo '<div class="gallery-title"><h4>' . $NV_title . '</h4></div>';
    }
    // TITLE
    echo '<div id="id-' . $NV_shortcode_id . '" class="post-gallery-wrap shortcode nv-skin id-' . $NV_shortcode_id . ' ' . $align . ' gallery-wrap ';
    if (!empty($NV_gallery_effect)) {
        echo $NV_gallery_effect;
    }
    echo '" style="';
    if (empty($NV_customlayer)) {
        echo $NV_gallerywrap_style;
    }
    echo '" 
		data-stage-type="' . $NV_show_slider . '" 
		data-stage-nav="' . $NV_stageplaypause . '" 
		data-stage-effect="' . $NV_animation . '" 
		data-stage-easing="' . $NV_tween . '">';
    if ($NV_show_slider != 'islider') {
        if ($NV_stageplaypause == "enabled" || $NV_stageplaypause == "leftrightonly") {
            echo '<div class="slidernav-left nvcolor-wrap">';
            echo '<span class="nvcolor"></span>';
            echo '<div class="slidernav">';
            echo '<a class="nivo-prevNav poststage-prev nav-prev"></a>';
            echo '</div>';
            echo '</div>';
            echo '<div class="slidernav-right nvcolor-wrap">';
            echo '<span class="nvcolor"></span>';
            echo '<div class="slidernav">';
            echo '<a class="nivo-nextNav poststage-next nav-next"></a>';
            echo '</div>';
            echo '</div>';
        }
        if ($NV_stageplaypause != "disabled" && $NV_stageplaypause != "leftrightonly") {
            echo '<div class="control-wrap">';
            echo '<div class="control-panel">';
            echo '</div><!-- / control-panel -->';
            echo '</div><!-- / control-wrap -->';
        }
    }
    echo '<div class="slider-inner-wrap" ' . $NV_gallery_format . '>';
    echo '<div class="' . $NV_gallery_type . '" ' . $NV_gallery_extras . '>';
    if ($NV_gallery_type == 'stage-slider') {
        echo '<img src="' . get_template_directory_uri() . '/images/blank.gif">';
    }
    /* ------------------------------------
    		
    		:: LOAD DATA SOURCE
    		
    		------------------------------------*/
    if (empty($data_source)) {
        if (!empty($NV_attachedmedia)) {
            $NV_datasource = 'data-1';
        }
        if (!empty($NV_gallerycat) || !empty($NV_gallerypostformat)) {
            $NV_datasource = 'data-2';
        }
        if (!empty($NV_flickrset)) {
            $NV_datasource = 'data-3';
        }
        if (!empty($NV_slidesetid)) {
            $NV_datasource = 'data-4';
        }
        if (!empty($NV_productcat) || !empty($NV_producttag)) {
            $NV_datasource = 'data-5';
        }
        if (!empty($NV_mediacat)) {
            $NV_datasource = 'data-6';
        }
        if (!empty($NV_pagepost_id)) {
            $NV_datasource = 'data-8';
        }
    } else {
        $NV_datasource = $data_source;
    }
    if ($NV_datasource == "data-1") {
        include NV_FILES . '/inc/classes/post-attachments-class.php';
    } elseif ($NV_datasource == "data-2" || $NV_datasource == "data-5" || $NV_datasource == "data-6" || $NV_datasource == "data-8") {
        include NV_FILES . '/inc/classes/post-categories-class.php';
    } elseif ($NV_datasource == "data-3") {
        include NV_FILES . '/inc/classes/flickr-class.php';
    } elseif ($NV_datasource == "data-4") {
        include NV_FILES . '/inc/classes/slideset-class.php';
    }
    /* ------------------------------------
    	
    	:: LOAD DATA SOURCE *END*
    	
    	------------------------------------*/
    $slidenum_chk = $postcount;
    if (!empty($post_count)) {
        $slidenum_chk = $post_count;
    }
    echo '</div><!-- / slider-inner-wrap -->';
    echo '</div><!-- / stageslider -->';
    if ($NV_show_slider == 'islider') {
        // iSlider Image Nav
        $NV_navimg = rTrim($NV_navimg, ',');
        $NV_navimg = explode(',', $NV_navimg);
        if (!empty($NV_imgheight)) {
            $NV_navimg_height = $NV_imgheight / 3 + 1;
        }
        $params = '';
        $params['width'] = $NV_navimg_width;
        if (!empty($NV_navimg_height)) {
            $params['height'] = $NV_navimg_height;
        }
        $params['crop'] = true;
        echo '<div class="islider-nav-wrap">';
        echo '<div class="nvcolor-wrap">';
        echo '<span class="nvcolor"></span>';
        echo '<div class="nav-prev islider-nav"></div>';
        echo '</div>';
        echo '<ul class="islider-nav-ul" style="height:' . $NV_imgheight . 'px">';
        echo '<li class="copynav">';
        echo '<ul>';
        foreach ($NV_navimg as $NV_navimg) {
            echo '<li><a href="#"><img src="' . dyn_getimagepath($NV_navimg) . '" /></a></li>';
        }
        echo '</ul>';
        echo '</li>';
        echo '</ul>';
        echo '</div>';
    }
    echo '<input name="' . $NV_shortcode_id . '_timeout_array" class="timeout_array" value="' . $NV_slidearray . '" type="hidden" />';
    echo '<input name="' . $NV_shortcode_id . '_timeout" class="timeout" value="' . $NV_stagetimeout . '" type="hidden" />';
    echo '<div class="clear"></div>';
    echo '</div><!-- / gallery-wrap -->';
    // enqueue scripts
    if ($NV_show_slider == 'nivo') {
        wp_deregister_script('nivo-slider');
        wp_register_script('nivo-slider', get_template_directory_uri() . '/js/nivo.slider.min.js', false, array('jquery'), true);
        wp_enqueue_script('nivo-slider');
    } else {
        wp_deregister_script('jquery-cycle');
        wp_register_script('jquery-cycle', get_template_directory_uri() . '/js/jquery.cycle.plugin.min.js', false, array('jquery'), true);
        wp_enqueue_script('jquery-cycle');
        wp_deregister_script('touch-gestures');
        wp_register_script('touch-gestures', get_template_directory_uri() . '/js/touch.gestures.min.js', false, array('jquery'), true);
        wp_enqueue_script('touch-gestures');
        wp_deregister_script('stage-slider');
        wp_register_script('stage-slider', get_template_directory_uri() . '/js/stage.slider.min.js', false, array('jquery-cycle'), true);
        wp_enqueue_script('stage-slider');
    }
    $output_string = ob_get_contents();
    ob_end_clean();
    return $output_string;
}
Esempio n. 12
0
        $thrown = throwSessions();
    }
}
//Set the language into a session variable
$lang_user_now = isset($_GET['lang']) ? $_GET['lang'] : '';
if (isset($_GET['lang'])) {
    $_SESSION['language'] = checkLang($lang_user_now);
    $_SESSION['Update_application_noframe'] = "True";
    unset($_SESSION['filter_page']);
}
//First time the user connects
$check_lang_auto = isset($_GET['check_lang_auto']) ? $_GET['check_lang_auto'] == "true" : true;
if (!isset($_SESSION['language']) && $check_lang_auto) {
    //Get the client language
    $clientLang = explode(",", $HTTP_ACCEPT_LANGUAGE);
    $clientLang = ucFirst(StrToLower(subStr(rTrim($clientLang[0]), 0, 2)));
    //Check if this language is available (return En if not)
    $language = checkLang($clientLang);
    //If the requested URI is a file
    if (strpos($_SERVER["PHP_SELF"], '.php') !== false) {
        //$_SERVER['REQUEST_URI'], '.php') !== false) {
        //Get the file's name
        $parentName = basename($_SERVER["PHP_SELF"]);
    } else {
        //Get the default value
        $parentName = "index.php";
    }
    //Get the URL Parameters
    $url_parameters = "";
    foreach ($_GET as $key => $value) {
        if ($key != "lang" && $key != "logout") {
Esempio n. 13
0
function IO_RmDir($Folder)
{
    #-------------------------------------------------------------------------------
    $Folder = Preg_Replace('/\\/{2,}/', '/', rTrim($Folder, '/'));
    #-------------------------------------------------------------------------------
    if (StrPos(SPrintF('/%s/', $Folder), SYSTEM_PATH) === FALSE) {
        return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка безопасности при удалении (%s)', $Folder));
    }
    #-------------------------------------------------------------------------------
    $Entities = IO_Scan($Folder, FALSE);
    if (Is_Error($Entities)) {
        return ERROR | @Trigger_Error('[IO_RmDir]: не удалось получить содержимое папки');
    }
    #-------------------------------------------------------------------------------
    if (Count($Entities)) {
        #-------------------------------------------------------------------------------
        foreach ($Entities as $Entity) {
            #-------------------------------------------------------------------------------
            $Entity = SPrintF('%s/%s', $Folder, $Entity);
            #-------------------------------------------------------------------------------
            if (Is_Dir($Entity)) {
                #-------------------------------------------------------------------------------
                if (Is_Error(IO_RmDir($Entity))) {
                    return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка рекурсивного вызова при удалении (%s)', $Entity));
                }
                #-------------------------------------------------------------------------------
            } else {
                #-------------------------------------------------------------------------------
                if (!UnLink($Entity)) {
                    return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка при удалении файла (%s)', $Entity));
                }
                #-------------------------------------------------------------------------------
            }
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    if (!@RmDir($Folder)) {
        return ERROR | @Trigger_Error(SPrintF('[IO_RmDir]: ошибка при удалении директории (%s)', $Folder));
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    return TRUE;
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
}
Esempio n. 14
0
function setlayer_html($layer, $setvalue, $skin)
{
    $get_skin_data = maybe_unserialize(get_option('skin_data_' . $skin));
    // CYCLE
    if ($setvalue == $layer . '_cycle') {
        $cycle_timeout = isset($get_skin_data['skin_id_' . $layer . '_cycle_timeout']) ? $get_skin_data['skin_id_' . $layer . '_cycle_timeout'] : '';
        // Cycle Timeout
        if (!empty($cycle_timeout)) {
            $timeout = 'timeout="' . $cycle_timeout . '"';
        }
        if (!isset($timeout)) {
            $timeout = '';
        }
        if (isset($get_skin_data['skin_id_' . $layer . '_datasource'])) {
            $cycle_datasource = $get_skin_data['skin_id_' . $layer . '_datasource'];
        } else {
            $cycle_datasource = '';
        }
        if (isset($get_skin_data['skin_id_' . $layer . '_cycle_attached'])) {
            $cycle_attached = $get_skin_data['skin_id_' . $layer . '_cycle_attached'];
        } else {
            $cycle_attached = '';
        }
        if (isset($get_skin_data['skin_id_' . $layer . '_cycle_pagepost_id'])) {
            $cycle_pagepost_id = $get_skin_data['skin_id_' . $layer . '_cycle_pagepost_id'];
        } else {
            $cycle_pagepost_id = '';
        }
        if (isset($get_skin_data['skin_id_' . $layer . '_cycle_cat'])) {
            $cycle_cat = $get_skin_data['skin_id_' . $layer . '_cycle_cat'];
        } else {
            $cycle_cat = '';
        }
        if (isset($get_skin_data['skin_id_' . $layer . '_cycle_flickr'])) {
            $cycle_flickr = $get_skin_data['skin_id_' . $layer . '_cycle_flickr'];
        } else {
            $cycle_flickr = '';
        }
        if (isset($get_skin_data['skin_id_' . $layer . '_cycle_slideset'])) {
            $cycle_slideset = $get_skin_data['skin_id_' . $layer . '_cycle_slideset'];
        } else {
            $cycle_slideset = '';
        }
        if (isset($get_skin_data['skin_id_' . $layer . '_cycle_prodcat'])) {
            $cycle_prodcat = $get_skin_data['skin_id_' . $layer . '_cycle_prodcat'];
        } else {
            $cycle_prodcat = '';
        }
        if (isset($get_skin_data['skin_id_' . $layer . '_cycle_prodtag'])) {
            $cycle_prodtag = $get_skin_data['skin_id_' . $layer . '_cycle_prodtag'];
        } else {
            $cycle_prodtag = '';
        }
        if (isset($get_skin_data['skin_id_' . $layer . '_cycle_mediacat'])) {
            $cycle_mediacat = $get_skin_data['skin_id_' . $layer . '_cycle_mediacat'];
        } else {
            $cycle_mediacat = '';
        }
        // Datasource
        if ($cycle_datasource) {
            if (strpos($cycle_datasource, 'data-1') !== false && $cycle_attached != '') {
                $datasource = 'attached_id="' . $cycle_attached . '"';
            } elseif (strpos($cycle_datasource, 'data-2') !== false && $cycle_cat != '') {
                $data = rTrim($cycle_cat, ',');
                $datasource = 'categories="' . $data . '"';
            } elseif (strpos($cycle_datasource, 'data-3') != false && $cycle_flickr != '') {
                $datasource = 'flickr_set="' . $cycle_flickr . '"';
            } elseif (strpos($cycle_datasource, 'data-4') != false && $cycle_slideset != '') {
                $data = rTrim($cycle_slideset, ',');
                $datasource = 'slidesetid="' . $data . '"';
            } elseif (strpos($cycle_datasource, 'data-5') !== false) {
                // Product Cats
                if ($cycle_prodcat) {
                    $data = rTrim($cycle_prodcat, ',');
                    $datasource = 'product_categories="' . $data . '"';
                }
                // Product Tags
                if ($cycle_prodtag) {
                    $data = rTrim($cycle_prodtag, ',');
                    $datasource .= ' product_tags="' . $data . '"';
                }
            } elseif (strpos($cycle_datasource, 'data-6') !== false && $cycle_mediacat != '') {
                $data = rTrim($cycle_mediacat, ',');
                $datasource = 'media_categories="' . $data . '"';
            } elseif (strpos($cycle_datasource, 'data-8') !== false && $cycle_pagepost_id != '') {
                $data = rTrim($cycle_pagepost_id, ',');
                $datasource = 'pagepost_id="' . $data . '"';
            }
            return do_shortcode('[postgallery_image  id="' . $layer . '" navigation="disabled" customlayer="yes" speed="1000" ' . $datasource . ' animation="fade" tween="easeOutSine"  ' . $timeout . ' /]');
        }
    }
    // IMAGE FULL
    if ($setvalue == $layer . '_imagefull') {
        $image_featured = isset($get_skin_data['skin_id_' . $layer . '_imagefeatured']) ? $get_skin_data['skin_id_' . $layer . '_imagefeatured'] : '';
        if ($image_featured == 'enable') {
            $post_image_id = get_post_thumbnail_id(get_the_ID());
            if (!empty($post_image_id)) {
                $thumbnail = wp_get_attachment_image_src($post_image_id, 'post-thumbnail', false);
                $imagefull = $thumbnail[0];
                $imagefull = parse_url($imagefull, PHP_URL_PATH);
                // make relative Image URL
            } else {
                $imagefull = isset($get_skin_data['skin_id_' . $layer . '_imagefull']) ? $get_skin_data['skin_id_' . $layer . '_imagefull'] : '';
            }
        } else {
            $imagefull = isset($get_skin_data['skin_id_' . $layer . '_imagefull']) ? $get_skin_data['skin_id_' . $layer . '_imagefull'] : '';
        }
        if (!empty($imagefull)) {
            return '<div class="fullimage"><img src="' . $imagefull . '" alt="&nbsp;" /></div>';
        }
    }
    // VIDEO
    if ($setvalue == $layer . '_video') {
        $video = isset($get_skin_data['skin_id_' . $layer . '_video']) ? $get_skin_data['skin_id_' . $layer . '_video'] : '';
        $video_type = isset($get_skin_data['skin_id_' . $layer . '_video_type']) ? $get_skin_data['skin_id_' . $layer . '_video_type'] : '';
        $video_loop = isset($get_skin_data['skin_id_' . $layer . '_video_loop']) ? $get_skin_data['skin_id_' . $layer . '_video_loop'] : '';
        if (!empty($video_type) && !empty($video)) {
            return do_shortcode('[videoembed type="' . $video_type . '"  url="' . $video . '" loop="' . $video_loop . '" customlayer="yes" autoplay="yes" id="' . $layer . '-video"]');
        }
    }
}
Esempio n. 15
0
 case 'exception':
     return 'Файл базы данных не был загружен';
 case 'array':
     #---------------------------------------------------------------------------
     $Data = $Upload['Data'];
     #---------------------------------------------------------------------------
     if ($gZip = @GzInflate(SubStr($Upload['Data'], 10))) {
         #-------------------------------------------------------------------------
         echo "Файл базы данных является сжатым файлом gzip\n";
         #-------------------------------------------------------------------------
         $Data = $gZip;
     } else {
         echo "Файл базы данных не является сжатым файлом gzip\n";
     }
     #---------------------------------------------------------------------------
     $File = rTrim($Upload['Name'], '.gz');
     #---------------------------------------------------------------------------
     $File = PathInfo($File);
     #---------------------------------------------------------------------------
     switch (StrToLower($File['extension'])) {
         case 'xml':
             #-----------------------------------------------------------------------
             $Data = String_XML_Parse($Data);
             if (Is_Exception($Data)) {
                 return SPrintF('Ошибка чтения базы данных: (%s)', $Data->String);
             }
             #-----------------------------------------------------------------------
             break;
         case 'serialize':
             #-----------------------------------------------------------------------
             $Data = UnSerialize($Data);
Esempio n. 16
0
function PubDateVerify($userStr, $type)
{
    $userStr = rTrim($userStr, ' ');
    $space = 32;
    $semicolon = 58;
    $comma = 44;
    $aError = array();
    $aM = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
    $aD = array("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun");
    $thisTz = date('T', time());
    $aError['valid'] = 'yes';
    $aError['msg'] = '';
    $aError['Day'] = '';
    $aError['Day #'] = '';
    $aError['month'] = '';
    $aError['year'] = '';
    $aError['tz'] = '';
    $aError['hh'] = '';
    $aError['mm'] = '';
    $aError['ss'] = '';
    $allErrorsMsg = 'All errors may be cause by a ' . 'single error in any part of the pubdate. For example: The date ' . 'is on Tue, not Mon, or a day 32 or misspelled day or month, ';
    $allErrorsMsg = '<span title="' . $allErrorsMsg . '">Note: (more></span>';
    //pubdate is not required
    if ($userStr == '') {
        $aError['valid'] = 'yes';
        $aError['msg'] .= '';
        $aError['hd'] = '';
        return $aError;
    }
    //get a working array of the attributes
    $userS = str_replace(',', '', $userStr);
    $aUser = explode(' ', $userS);
    //get the date and time that these functions think it is
    $compT = strToTime($userStr);
    $compS = date('D d M Y H:i:s T', $compT);
    $engS = date('l, F jS Y g:i:s A T', $compT);
    $aError['hd'] = $engS;
    if ($userS == $compS) {
        $aError['valid'] = 'yes';
        $aError['msg'] .= 'Valid Pubdate: ' . $userS . '.' . '<br />or ' . $engS . '.';
        $aError['hd'] = $engS;
        return $aError;
    }
    $tError = 0;
    $aChar = count_chars($userStr, 1);
    if (isset($aChar[$space])) {
        if ($aChar[$space] < 5) {
            $aError['msg'] .= 'There are too few spaces. ' . 'or the pubdate does not have all six components ' . '(DDD, dd MMM YYYY hh:mm:ss TZN).<br />';
            $tError = 1;
        }
        if ($aChar[$space] > 5) {
            $aError['msg'] .= 'There are too many spaces.<br />';
            $tError = 1;
        }
    }
    if (substr($userStr, 3, 1) != ',') {
        $aError['msg'] .= 'There should be a comma immediately after the 3 character, day abbreviation.<br />';
        $tError = 1;
    }
    if (isset($aChar[$comma])) {
        if ($aChar[$comma] > 1) {
            $aError['msg'] .= 'There should only be a comma immediately after the 3 character, day abbreviation.<br />';
            $tError = 1;
        }
    }
    if (isset($aChar[$semicolon])) {
        if ($aChar[$semicolon] != 2) {
            $aError['msg'] .= "The time components should be separated by a semicolon - :.<br />";
            $tError = 1;
        }
    }
    if ($tError) {
        $aError['valid'] = 'no';
        $aError['msg'] .= '<br />' . $allErrorsMsg;
        $aError['msg'] = cleanMsg($aError['msg']);
        return $aError;
    }
    //don't continue if all 6 attributes are not there
    if (count($aUser) != 6) {
        $aError['valid'] = 'no';
        if ($type == 'v') {
            $aError['msg'] .= 'Invalid Pubdate: This validation only works when all six components of ' . 'the pubdate are entered (DDD, dd MMM YYYY hh:mm:ss TZN). ' . 'RSS Feed Validation will fail.';
        } else {
            $aError['msg'] .= 'Invalid Pubdate: All six components of ' . 'the pubdate must be present (DDD, dd MMM YYYY hh:mm:ss TZN). ' . 'RSS Feed Validation will fail.';
        }
        return $aError;
    }
    //gross errors
    $tError = 0;
    if (!in_array($aUser[0], $aD)) {
        $aError['Day'] .= "Invalid day abbreviation '" . $aUser[0] . "'.<br />";
        $tError = 1;
    } else {
        if ($aUser[0] != ucWords($aUser[0])) {
            $tError = 1;
            $aError['Day'] .= "The day abbreviation '" . $aUser[0] . "' first character must be uppercase. (ex: Mon not MONor mon).<br />";
        }
    }
    if ($aUser[1] < 1 || $aUser[1] > 31) {
        $tError = 1;
        $aError['Day #'] .= "The numeric day '" . $aUser[1] . "' is not in the range 01 - 31.<br />";
    }
    if (strlen($aUser[1]) != 2) {
        $tError = 1;
        $aError['Day #'] .= "The numeric day '" . $aUser[1] . "' must be 2 digits (ex: 01 not 1).<br />";
    }
    if (!in_array($aUser[2], $aM)) {
        $tError = 1;
        $aError['month'] .= "Invalid month abbreviation '" . $aUser[2] . "'.<br />";
    }
    if ($aUser[2] != ucWords($aUser[2])) {
        $tError = 1;
        $aError['month'] .= "The month abbreviation '" . $aUser[2] . "' first character must be uppercase. (ex: Jan not JAN or jan).<br />";
    }
    if (strlen($aUser[3]) != 4) {
        $tError = 1;
        $aError['year'] .= "The numeric year '" . $aUser[3] . "' must be 4 digits (ex: 2012 not 12).<br />";
    }
    // time ranges
    $aT = explode(':', $aUser[4]);
    if ($aT[0] > 23) {
        $tError = 1;
        $aError['hh'] .= 'Hour(s) greater than 23' . '.<br />';
    }
    if (strlen($aT[0]) != 2) {
        $tError = 1;
        $aError['hh'] .= 'Hour(s) ' . $aT[0] . ' must be 2 digits (ex: 01 not 1)<br />';
    }
    if ($aT[1] > 59) {
        $tError = 1;
        $aError['mm'] .= 'Minute(s) greater than 59' . '.<br />';
    }
    if (strlen($aT[1]) != 2) {
        $tError = 1;
        $aError['mm'] .= 'Minutes(s) ' . $aT[1] . ' must be 2 digits (ex: 01 not 1)<br />';
    }
    if ($aT[2] > 59) {
        $tError = 1;
        $aError['ss'] .= 'Second(s) greater than 59' . '.<br />';
    }
    if (strlen($aT[2]) != 2) {
        $tError = 1;
        $aError['ss'] .= 'Seconds(s) ' . $aT[2] . ' must be 2 digits (ex: 01 not 1)<br />';
    }
    if (strlen($aUser[5]) < 2 || strlen($aUser[5]) > 5) {
        $tError = 1;
        $aError['tz'] .= 'The time zone must be from 2 to 5 characters.<br />';
    }
    if ($aUser[5] != strToUpper($aUser[5])) {
        $tError = 1;
        $aError['tz'] .= 'The time zone must be upper case characters.<br />';
    }
    //check for gross erros
    if ($tError) {
        $aError['valid'] = 'no';
        $aError['msg'] .= $allErrorsMsg;
        $aError['msg'] = cleanMsg($aError['msg']);
        return $aError;
    }
    //check for different timezoe, files may have been moved to serve
    //in a different timezone
    if ($aUser[5] != $thisTz) {
        $aError['valid'] = 'wrn';
        $tzWrn = 'The timezone entered ' . $aUser[5] . ' ' . 'is not equal to this servers timezone ' . $thisTz . '.<br />' . 'This may be an error or if editing a file, the file may have ' . 'been moved to this server having a differen timezone.<br />' . 'Care should be taken before changing the timezone, to avoid ' . 'republishing.';
        $aError['msg'] .= 'Warning only: This servers TZ is ' . $thisTz . ', not ' . $aUser[5] . '. <span title="' . $tzWrn . '">(more)</span><br />';
    }
    // ed if for different timezone
    //at this point we have all six attributs and the tiemzone agrees
    $aError['od'] = $userS;
    $aError['nd'] = $compS;
    $aError['hd'] = $engS;
    // check the parts
    //day
    if ($thisTz == $aUser[5]) {
        $aError['Day'] = '';
        $tmpS = $aUser[1] . ' ' . $aUser[2] . ' ' . $aUser[3] . ' ' . $aUser[4] . ' ' . $aUser[5];
        $tmpT = strToTime($tmpS);
        $tmpD = date('D', $tmpT);
        if ($aUser[0] != $tmpD) {
            $aError['valid'] = 'no';
            $aError['Day'] = 'The day ' . $aUser[1] . ' ' . $aUser[2] . ' ' . $aUser[3] . ' is on ' . $tmpD . ' not ' . $aUser[0] . '.<br />';
        }
    }
    //year
    $aError['year'] = '';
    $tmpS = $aUser[1] . ' ' . $aUser[2] . ' ' . $aUser[5];
    $tmpT = strToTime($tmpS);
    $tmpD = date('Y', $tmpT);
    if ($aUser[3] != $tmpD) {
        $aError['valid'] = 'no';
        $aError['year'] = 'The year ' . $aUser[3] . ' is in ' . $tmpD . ' for ' . $aUser[0] . ' ' . $aUser[1] . ' in ' . $aUser[2] . '.<br />';
    } else {
        if ($aUser[3] <= date('Y', time()) - 1) {
            $aError['valid'] = 'no';
            $aError['year'] = 'Year ' . $aUser[3] . ' is previous to the current year.<br />';
        }
    }
    if ($aError['valid'] == 'no') {
        $aError['valid'] = 'no';
        $aError['msg'] .= '<br />' . $allErrorsMsg;
        $aError['msg'] = cleanMsg($aError['msg']);
        return $aError;
    }
    return $aError;
}
    echo '</td>', "\n";
    echo '</tr>', "\n";
    ?>
</tbody>
</table>

<br />
<br />
<?php 
    echo __('Registrierungs-Status');
    echo ' (', __('lokaler Asterisk'), ')';
    ?>
<br />
<div style="font-family:monospace; white-space:pre; background:#eee; border:1px solid #e9e9e9; padding:1px 3px;"><?php 
    $err = 0;
    $out = array();
    @exec('sudo asterisk -rx ' . qsa('iax2 show registry') . ' 2>>/dev/null', $out, $err);
    if ($err !== 0) {
        echo '?';
    } else {
        foreach ($out as $line) {
            echo preg_replace(array('/^(\\s*)([a-zA-Z0-9.\\-_]+[.\\-_][a-zA-Z0-9.\\-_]+)/', '/\\b(Registered|Unregistered|Rejected)\\b/'), array('$1<b>$2</b>', '<b>$1</b>'), rTrim($line)), "\n";
        }
    }
    ?>
</div>


<?php 
}
#####################################################################
Esempio n. 18
0
 # ???
 _set_cfg('reg-number', null, $user_ext);
 # ???
 _set_cfg('fully-qualified-phone-no', null, $user_ext);
 # ???
 _set_cfg('sip-pwd', null, $user['secret']);
 _set_cfg('sip-name', null, _siemens_xml_esc(mb_subStr(rTrim(preg_replace('/<[^>]*>/', '', $user['callerid'])), 0, 24)));
 _set_cfg('register-by-name', null, 'false');
 $tmp = $user_ext . ' ';
 if ($user['firstname'] != '') {
     $tmp .= mb_subStr($user['firstname'], 0, 1);
 }
 if ($user['lastname'] != '') {
     $tmp .= mb_subStr($user['lastname'], 0, 3);
 }
 $tmp = _siemens_xml_esc(mb_subStr(rTrim($tmp), 0, 24));
 _set_cfg('display-id', null, _siemens_xml_esc($tmp));
 # max. 24 chars
 _set_cfg('display-id-unicode', null, _siemens_xml_esc($tmp));
 #  "
 _set_cfg('use-display-id', null, 'true');
 _set_cfg('reg-addr', null, $host);
 _set_cfg('reg-port', null, '5060');
 _set_cfg('registrar-addr', null, $host);
 _set_cfg('registrar-port', null, '5060');
 _set_cfg('outbound-proxy', null, $sip_proxy_and_sbc['sip_proxy_from_wan'] != '' ? 'true' : 'false');
 _set_cfg('outbound-proxy-user', null, $sip_proxy_and_sbc['sip_proxy_from_wan'] != '' ? 'true' : 'false');
 _set_cfg('sgnl-gateway-addr', null, $sip_proxy_and_sbc['sip_proxy_from_wan'] != '' ? $sip_proxy_and_sbc['sip_proxy_from_wan'] : $host);
 _set_cfg('sgnl-gateway-addr-user', null, $sip_proxy_and_sbc['sip_proxy_from_wan'] != '' ? $sip_proxy_and_sbc['sip_proxy_from_wan'] : $host);
 _set_cfg('sgnl-gateway-port', null, '5060');
 _set_cfg('sgnl-gateway-port-user', null, '5060');