Beispiel #1
0
function friendlycase($title)
{
    $ourData = get_option('fc_options');
    $lowerCaseWords = array_map('trim', explode(',', $ourData['fc_text_lc']));
    $upperCaseWords = array_map('trim', explode(',', $ourData['fc_text_uc']));
    $ignoredWords = array_map('trim', explode(',', $ourData['fc_text_ig']));
    $firstonly = $ourData['fc_firstonly'];
    $wrapinspans = $ourData['fc_wrappit'];
    $words = explode(' ', $title);
    $countCycles = 0;
    foreach ($words as $k => $word) {
        $countCycles = $countCycles + 1;
        if (in_arrayi($word, $lowerCaseWords)) {
            $words[$k] = $wrapinspans == 1 ? "<span class='fc_lc'>" . mb_strtolower($word) . "</span>" : mb_strtolower($word);
        } elseif (in_arrayi($word, $upperCaseWords)) {
            $words[$k] = $wrapinspans == 1 ? "<span class='fc_uc'>" . strtoupper($word) . "</span>" : strtoupper($word);
        } elseif (in_arrayi($word, $ignoredWords)) {
            $n = in_arrayi($word, $ignoredWords);
            $words[$k] = $wrapinspans == 1 ? "<span class='fc_ig'>" . $ignoredWords[$n] . "</span>" : $ignoredWords[$n];
        } elseif ($firstonly == 1) {
            if ($countCycles == 1) {
                $words[$k] = ucwords(mb_strtolower($word));
            } else {
                $words[$k] = mb_strtolower($word);
            }
        } else {
            $words[$k] = ucwords(mb_strtolower($word));
        }
    }
    $newtitle = implode(' ', $words);
    return ucfirst($newtitle);
}
 /**
  * Run validation on the server side
  *
  * Method will run the validation on the server side (will not run the JS function type) and return
  * the result
  *
  * @access public
  * @param string &$errmsg The error message if the validation fails
  * @return bool TRUE if the validation was successful, FALSE if it failed
  */
 public function runValidation(&$errmsg)
 {
     if (!parent::runValidation($errmsg)) {
         return false;
     }
     if ($this->getValue() == '') {
         return true;
     }
     /**
      * Just need to check that all our selected values actually existing within our options array
      */
     if (empty($this->extraInfo['options'])) {
         return true;
     }
     if (!in_arrayi($this->getValue(), $this->extraInfo['options'])) {
         $errmsg = sprintf(GetLang('CustomFieldsValidationInvalidSelectOption'), $this->label);
         return false;
     }
     return true;
 }
Beispiel #3
0
function dirprofile_init(&$a)
{
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        notice(t('Public access denied.') . EOL);
        return;
    }
    $hash = $_REQUEST['hash'];
    if (!$hash) {
        return '';
    }
    $o = '';
    $dirmode = intval(get_config('system', 'directory_mode'));
    if ($dirmode == DIRECTORY_MODE_PRIMARY || $dirmode == DIRECTORY_MODE_STANDALONE) {
        $url = z_root() . '/dirsearch';
    }
    if (!$url) {
        $directory = find_upstream_directory($dirmode);
        $url = $directory['url'] . '/dirsearch';
    }
    logger('mod_directory: URL = ' . $url, LOGGER_DEBUG);
    $contacts = array();
    if (local_user()) {
        $x = q("select abook_xchan from abook where abook_channel = %d", intval(local_user()));
        if ($x) {
            foreach ($x as $xx) {
                $contacts[] = $xx['abook_xchan'];
            }
        }
    }
    if ($url) {
        $query = $url . '?f=&hash=' . $hash;
        $x = z_fetch_url($query);
        logger('dirprofile: return from upstream: ' . print_r($x, true), LOGGER_DATA);
        if ($x['success']) {
            $t = 0;
            $j = json_decode($x['body'], true);
            if ($j) {
                if ($j['results']) {
                    $entries = array();
                    $photo = 'thumb';
                    foreach ($j['results'] as $rr) {
                        $profile_link = chanlink_url($rr['url']);
                        $pdesc = $rr['description'] ? $rr['description'] . '<br />' : '';
                        $qrlink = zid($rr['url']);
                        $connect_link = local_user() ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : '';
                        $online = remote_online_status($rr['address']);
                        if (in_array($rr['hash'], $contacts)) {
                            $connect_link = '';
                        }
                        $details = '';
                        if (strlen($rr['locale'])) {
                            $details .= $rr['locale'];
                        }
                        if (strlen($rr['region'])) {
                            if (strlen($rr['locale'])) {
                                $details .= ', ';
                            }
                            $details .= $rr['region'];
                        }
                        if (strlen($rr['country'])) {
                            if (strlen($details)) {
                                $details .= ', ';
                            }
                            $details .= $rr['country'];
                        }
                        if (strlen($rr['birthday'])) {
                            if (($years = age($rr['birthday'], 'UTC', '')) != 0) {
                                $details .= '<br />' . t('Age: ') . $years;
                            }
                        }
                        if (strlen($rr['gender'])) {
                            $details .= '<br />' . t('Gender: ') . $rr['gender'];
                        }
                        $page_type = '';
                        $profile = $rr;
                        if (x($profile, 'locale') == 1 || x($profile, 'region') == 1 || x($profile, 'postcode') == 1 || x($profile, 'country') == 1) {
                            $location = t('Location:');
                        }
                        $marital = x($profile, 'marital') == 1 ? t('Status: ') . $profile['marital'] : False;
                        $sexual = x($profile, 'sexual') == 1 ? t('Sexual Preference: ') . $profile['sexual'] : False;
                        $homepage = x($profile, 'homepage') == 1 ? t('Homepage: ') . linkify($profile['homepage']) : False;
                        $hometown = x($profile, 'hometown') == 1 ? t('Hometown: ') . $profile['hometown'] : False;
                        $about = x($profile, 'about') == 1 ? t('About: ') . bbcode($profile['about']) : False;
                        $keywords = x($profile, 'keywords') ? $profile['keywords'] : '';
                        if ($keywords) {
                            $keywords = str_replace(',', ' ', $keywords);
                            $keywords = str_replace('  ', ' ', $keywords);
                            $karr = explode(' ', $keywords);
                            $out = '';
                            if ($karr) {
                                if (local_user()) {
                                    $r = q("select keywords from profile where uid = %d and is_default = 1 limit 1", intval(local_user()));
                                    if ($r) {
                                        $keywords = str_replace(',', ' ', $r[0]['keywords']);
                                        $keywords = str_replace('  ', ' ', $keywords);
                                        $marr = explode(' ', $keywords);
                                    }
                                }
                                foreach ($karr as $k) {
                                    if (strlen($out)) {
                                        $out .= ', ';
                                    }
                                    if ($marr && in_arrayi($k, $marr)) {
                                        $out .= '<strong>' . $k . '</strong>';
                                    } else {
                                        $out .= $k;
                                    }
                                }
                            }
                        }
                        $entry = replace_macros(get_markup_template('direntry_large.tpl'), array('$id' => ++$t, '$profile_link' => $profile_link, '$qrlink' => $qrlink, '$photo' => $rr['photo_l'], '$alttext' => $rr['name'] . ' ' . $rr['address'], '$name' => $rr['name'], '$online' => $online ? t('Online Now') : '', '$details' => $pdesc . $details, '$profile' => $profile, '$address' => $rr['address'], '$location' => $location, '$gender' => $gender, '$pdesc' => $pdesc, '$marital' => $marital, '$homepage' => $homepage, '$hometown' => $hometown, '$about' => $about, '$kw' => $out ? t('Keywords: ') : '', '$keywords' => $out, '$conn_label' => t('Connect'), '$connect' => $connect_link));
                        echo $entry;
                        killme();
                    }
                } else {
                    info(t("Not found.") . EOL);
                }
            }
        }
    }
}
Beispiel #4
0
/**
 * @brief Imports a directory profile.
 *
 * @param string $hash
 * @param array $profile
 * @param string $addr
 * @param number $ud_flags
 * @param number $suppress_update default 0
 * @return boolean $updated if something changed
 */
function import_directory_profile($hash, $profile, $addr, $ud_flags = UPDATE_FLAGS_UPDATED, $suppress_update = 0)
{
    logger('import_directory_profile', LOGGER_DEBUG);
    if (!$hash) {
        return false;
    }
    $arr = array();
    $arr['xprof_hash'] = $hash;
    $arr['xprof_dob'] = datetime_convert('', '', $profile['birthday'], 'Y-m-d');
    // !!!! check this for 0000 year
    $arr['xprof_age'] = $profile['age'] ? intval($profile['age']) : 0;
    $arr['xprof_desc'] = $profile['description'] ? htmlspecialchars($profile['description'], ENT_COMPAT, 'UTF-8', false) : '';
    $arr['xprof_gender'] = $profile['gender'] ? htmlspecialchars($profile['gender'], ENT_COMPAT, 'UTF-8', false) : '';
    $arr['xprof_marital'] = $profile['marital'] ? htmlspecialchars($profile['marital'], ENT_COMPAT, 'UTF-8', false) : '';
    $arr['xprof_sexual'] = $profile['sexual'] ? htmlspecialchars($profile['sexual'], ENT_COMPAT, 'UTF-8', false) : '';
    $arr['xprof_locale'] = $profile['locale'] ? htmlspecialchars($profile['locale'], ENT_COMPAT, 'UTF-8', false) : '';
    $arr['xprof_region'] = $profile['region'] ? htmlspecialchars($profile['region'], ENT_COMPAT, 'UTF-8', false) : '';
    $arr['xprof_postcode'] = $profile['postcode'] ? htmlspecialchars($profile['postcode'], ENT_COMPAT, 'UTF-8', false) : '';
    $arr['xprof_country'] = $profile['country'] ? htmlspecialchars($profile['country'], ENT_COMPAT, 'UTF-8', false) : '';
    $arr['xprof_about'] = $profile['about'] ? htmlspecialchars($profile['about'], ENT_COMPAT, 'UTF-8', false) : '';
    $arr['xprof_homepage'] = $profile['homepage'] ? htmlspecialchars($profile['homepage'], ENT_COMPAT, 'UTF-8', false) : '';
    $arr['xprof_hometown'] = $profile['hometown'] ? htmlspecialchars($profile['hometown'], ENT_COMPAT, 'UTF-8', false) : '';
    $clean = array();
    if (array_key_exists('keywords', $profile) and is_array($profile['keywords'])) {
        import_directory_keywords($hash, $profile['keywords']);
        foreach ($profile['keywords'] as $kw) {
            $kw = trim(htmlspecialchars($kw, ENT_COMPAT, 'UTF-8', false));
            $kw = trim($kw, ',');
            $clean[] = $kw;
        }
    }
    $arr['xprof_keywords'] = implode(' ', $clean);
    // Self censored, make it so
    // These are not translated, so the German "erwachsenen" keyword will not censor the directory profile. Only the English form - "adult".
    if (in_arrayi('nsfw', $clean) || in_arrayi('adult', $clean)) {
        q("update xchan set xchan_selfcensored = 1 where xchan_hash = '%s'", dbesc($hash));
    }
    $r = q("select * from xprof where xprof_hash = '%s' limit 1", dbesc($hash));
    if ($arr['xprof_age'] > 150) {
        $arr['xprof_age'] = 150;
    }
    if ($arr['xprof_age'] < 0) {
        $arr['xprof_age'] = 0;
    }
    if ($r) {
        $update = false;
        foreach ($r[0] as $k => $v) {
            if (array_key_exists($k, $arr) && $arr[$k] != $v) {
                logger('import_directory_profile: update ' . $k . ' => ' . $arr[$k]);
                $update = true;
                break;
            }
        }
        if ($update) {
            q("update xprof set\n\t\t\t\txprof_desc = '%s',\n\t\t\t\txprof_dob = '%s',\n\t\t\t\txprof_age = %d,\n\t\t\t\txprof_gender = '%s',\n\t\t\t\txprof_marital = '%s',\n\t\t\t\txprof_sexual = '%s',\n\t\t\t\txprof_locale = '%s',\n\t\t\t\txprof_region = '%s',\n\t\t\t\txprof_postcode = '%s',\n\t\t\t\txprof_country = '%s',\n\t\t\t\txprof_about = '%s',\n\t\t\t\txprof_homepage = '%s',\n\t\t\t\txprof_hometown = '%s',\n\t\t\t\txprof_keywords = '%s'\n\t\t\t\twhere xprof_hash = '%s'", dbesc($arr['xprof_desc']), dbesc($arr['xprof_dob']), intval($arr['xprof_age']), dbesc($arr['xprof_gender']), dbesc($arr['xprof_marital']), dbesc($arr['xprof_sexual']), dbesc($arr['xprof_locale']), dbesc($arr['xprof_region']), dbesc($arr['xprof_postcode']), dbesc($arr['xprof_country']), dbesc($arr['xprof_about']), dbesc($arr['xprof_homepage']), dbesc($arr['xprof_hometown']), dbesc($arr['xprof_keywords']), dbesc($arr['xprof_hash']));
        }
    } else {
        $update = true;
        logger('import_directory_profile: new profile ');
        q("insert into xprof (xprof_hash, xprof_desc, xprof_dob, xprof_age, xprof_gender, xprof_marital, xprof_sexual, xprof_locale, xprof_region, xprof_postcode, xprof_country, xprof_about, xprof_homepage, xprof_hometown, xprof_keywords) values ('%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') ", dbesc($arr['xprof_hash']), dbesc($arr['xprof_desc']), dbesc($arr['xprof_dob']), intval($arr['xprof_age']), dbesc($arr['xprof_gender']), dbesc($arr['xprof_marital']), dbesc($arr['xprof_sexual']), dbesc($arr['xprof_locale']), dbesc($arr['xprof_region']), dbesc($arr['xprof_postcode']), dbesc($arr['xprof_country']), dbesc($arr['xprof_about']), dbesc($arr['xprof_homepage']), dbesc($arr['xprof_hometown']), dbesc($arr['xprof_keywords']));
    }
    $d = array('xprof' => $arr, 'profile' => $profile, 'update' => $update);
    call_hooks('import_directory_profile', $d);
    if ($d['update'] && !$suppress_update) {
        update_modtime($arr['xprof_hash'], random_string() . '@' . get_app()->get_hostname(), $addr, $ud_flags);
    }
    return $d['update'];
}
 private function ManageCustomers($MsgDesc = "", $MsgStatus = "")
 {
     $GLOBALS['HideClearResults'] = "none";
     $numCustomers = 0;
     // Fetch any results, place them in the data grid
     $GLOBALS['CustomerDataGrid'] = $this->ManageCustomersGrid($numCustomers);
     // Was this an ajax based sort? Return the table now
     if (isset($_REQUEST['ajax']) && $_REQUEST['ajax'] == 1) {
         echo $GLOBALS['CustomerDataGrid'];
         return;
     }
     if (isset($this->_customSearch['searchname'])) {
         $GLOBALS['ViewName'] = isc_html_escape($this->_customSearch['searchname']);
     } else {
         $GLOBALS['ViewName'] = GetLang('AllCustomers');
         $GLOBALS['HideDeleteViewLink'] = "none";
     }
     if (isset($this->_customSearch['searchname'])) {
         $GLOBALS['CustomSearchName'] = ": " . isc_html_escape($this->_customSearch['searchname']);
     }
     // Get the custom search as option fields
     $num_custom_searches = 0;
     $GLOBALS['CustomSearchOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CUSTOMSEARCH']->GetSearchesAsOptions(@$_GET['searchId'], $num_custom_searches, "AllCustomers", "viewCustomers", "customCustomerSearch");
     if (!isset($_REQUEST['searchId'])) {
         $GLOBALS['HideDeleteCustomSearch'] = "none";
     } else {
         $GLOBALS['CustomSearchId'] = (int) $_REQUEST['searchId'];
     }
     // Do we need to disable the add button?
     if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Add_Customer)) {
         $GLOBALS['DisableAdd'] = "DISABLED";
     }
     // Do we need to disable the delete button?
     if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Delete_Customers) || $numCustomers == 0) {
         $GLOBALS['DisableDelete'] = "DISABLED";
     }
     // Do we need to disable the expory button?
     if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Export_Customers) || $numCustomers == 0) {
         $GLOBALS['DisableExport'] = "DISABLED";
     }
     if (isset($_REQUEST['searchQuery']) || isset($_GET['searchId'])) {
         $GLOBALS['HideClearResults'] = "";
     }
     $GLOBALS['CustomerIntro'] = GetLang('ManageCustomersIntro');
     if ($numCustomers > 0) {
         if ($MsgDesc == "" && (isset($_REQUEST['searchQuery']) || isset($_GET['searchId']))) {
             if ($numCustomers == 1) {
                 $MsgDesc = GetLang('CustomerSearchResultsBelow1');
             } else {
                 $MsgDesc = sprintf(GetLang('CustomerSearchResultsBelowX'), $numCustomers);
             }
             $MsgStatus = MSG_SUCCESS;
         }
     } else {
         $GLOBALS['DisplayGrid'] = "none";
         if (count($_GET) > 1) {
             if ($MsgDesc == "") {
                 $GLOBALS['Message'] = MessageBox(GetLang('NoCustomerResults'), MSG_ERROR);
             }
         } else {
             // No actual custoemrs
             $GLOBALS['DisplaySearch'] = "none";
             $GLOBALS['Message'] = MessageBox(GetLang('NoCustomers'), MSG_SUCCESS);
         }
     }
     if (!gzte11(ISC_MEDIUMPRINT)) {
         $GLOBALS[base64_decode('SGlkZUV4cG9ydA==')] = "none";
     }
     if ($MsgDesc != "") {
         $GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
     }
     $flashMessages = GetFlashMessages();
     if (is_array($flashMessages) && !empty($flashMessages)) {
         $GLOBALS['Message'] = '';
         foreach ($flashMessages as $flashMessage) {
             $GLOBALS['Message'] .= MessageBox($flashMessage['message'], $flashMessage['type']);
         }
     }
     $GLOBALS['ExportAction'] = "index.php?ToDo=startExport&t=customers";
     if (isset($GLOBALS['CustomSearchId']) && $GLOBALS['CustomSearchId'] != '0') {
         $GLOBALS['ExportAction'] .= "&searchId=" . $GLOBALS['CustomSearchId'];
     } else {
         $query_params = explode('&', $_SERVER['QUERY_STRING']);
         $params = array();
         $ignore = array("ToDo");
         foreach ($query_params as $param) {
             $arr = explode("=", $param);
             if (!in_arrayi($arr[0], $ignore)) {
                 $params[$arr[0]] = $arr[1];
             }
         }
         if (count($params)) {
             $GLOBALS['ExportAction'] .= "&" . http_build_query($params);
         }
     }
     $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("customers.manage");
     $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
 }
Beispiel #6
0
 private function GetParams($query_string = "")
 {
     if (!$query_string) {
         $query_string = $_SERVER['QUERY_STRING'];
     }
     $query_params = explode('&', $query_string);
     $params = array();
     $ignore = array("ToDo", "t", "tempId", "searchId");
     foreach ($query_params as $param) {
         $arr = explode("=", $param);
         if (!in_arrayi($arr[0], $ignore)) {
             $params[$arr[0]] = $arr[1];
         }
     }
     return $params;
 }
Beispiel #7
0
    echo '<tr><td>GD Library</td><td><span class="WARNmsg" >' . i18n_r('NOT_INSTALLED') . ' - ' . i18n_r('WARNING') . '</span></td></tr>';
}
if (in_arrayi('zip', $php_modules)) {
    echo '<tr><td>ZipArchive</td><td><span class="OKmsg" >' . i18n_r('INSTALLED') . ' - ' . i18n_r('OK') . '</span></td></tr>';
} else {
    echo '<tr><td>ZipArchive</td><td><span class="WARNmsg" >' . i18n_r('NOT_INSTALLED') . ' - ' . i18n_r('WARNING') . '</span></td></tr>';
}
if (!in_arrayi('SimpleXML', $php_modules)) {
    echo '<tr><td>SimpleXML Module</td><td><span class="ERRmsg" >' . i18n_r('NOT_INSTALLED') . ' - ' . i18n_r('ERROR') . '</span></td></tr>';
} else {
    echo '<tr><td>SimpleXML Module</td><td><span class="OKmsg" >' . i18n_r('INSTALLED') . ' - ' . i18n_r('OK') . '</span></td></tr>';
}
if (server_is_apache()) {
    echo '<tr><td>Apache web server</td><td><span class="OKmsg" >' . $_SERVER['SERVER_SOFTWARE'] . ' - ' . i18n_r('OK') . '</span></td></tr>';
    if (function_exists('apache_get_modules')) {
        if (!in_arrayi('mod_rewrite', apache_get_modules())) {
            echo '<tr><td>Apache Mod Rewrite</td><td><span class="WARNmsg" >' . i18n_r('NOT_INSTALLED') . ' - ' . i18n_r('WARNING') . '</span></td></tr>';
        } else {
            echo '<tr><td>Apache Mod Rewrite</td><td><span class="OKmsg" >' . i18n_r('INSTALLED') . ' - ' . i18n_r('OK') . '</span></td></tr>';
        }
    } else {
        echo '<tr><td>Apache Mod Rewrite</td><td><span class="OKmsg" >' . i18n_r('INSTALLED') . ' - ' . i18n_r('OK') . '</span></td></tr>';
    }
} else {
    if (!getDef('GSNOAPACHECHECK') || GSNOAPACHECHECK == false) {
        echo '<tr><td>Apache web server</td><td><span class="ERRmsg" >' . $_SERVER['SERVER_SOFTWARE'] . ' - <b>' . i18n_r('ERROR') . '</b></span></td></tr>';
    }
}
?>
			</table>
			<p class="hint"><?php 
Beispiel #8
0
function validate_safe_file($file, $name, $mime)
{
    global $mime_type_blacklist, $file_ext_blacklist, $mime_type_whitelist, $file_ext_whitelist;
    include GSADMININCPATH . 'configuration.php';
    $file_extention = pathinfo($name, PATHINFO_EXTENSION);
    $file_mime_type = $mime;
    if ($mime_type_whitelist && in_arrayi($file_mime_type, $mime_type_whitelist)) {
        return true;
    } elseif ($file_ext_whitelist && $in_arrayi($file_extention, $file_ext_whitelist)) {
        return true;
    }
    // skip blackist checks if whitelists exist
    if ($mime_type_whitelist || $file_ext_whitelist) {
        return false;
    }
    if (in_arrayi($file_mime_type, $mime_type_blacklist)) {
        return false;
    } elseif (in_arrayi($file_extention, $file_ext_blacklist)) {
        return false;
    } else {
        return true;
    }
}
Beispiel #9
0
    // Advanced log filter form
    $form = new Form(new Form_Button('filterlogentries_submit', 'Filter'));
    $section = new Form_Section('Advanced Log Filter');
    $group = new Form_Group('');
    $group->add(new Form_Input('filterlogentries_sourceipaddress', null, 'text', $filterfieldsarray['srcip']))->setHelp('Source IP Address');
    $group->add(new Form_Input('filterlogentries_destinationipaddress', null, 'text', $filterfieldsarray['dstip']))->setHelp('Destination IP Address');
    $section->add($group);
    $group = new Form_Group('');
    $group->add(new Form_Checkbox('actpass', 'Pass', 'Pass', in_arrayi('Pass', $Include_Act)));
    $group->add(new Form_Input('filterlogentries_time', null, 'text', $filterfieldsarray['time']))->setHelp('Time');
    $group->add(new Form_Input('filterlogentries_sourceport', null, 'text', $filterfieldsarray['srcport']))->setHelp('Source Port');
    $group->add(new Form_Input('filterlogentries_protocol', null, 'text', $filterfieldsarray['proto']))->setHelp('Protocol');
    $group->add(new Form_Input('filterlogentries_qty', null, 'text', $filterlogentries_qty))->setHelp('Quantity');
    $section->add($group);
    $group = new Form_Group('');
    $group->add(new Form_Checkbox('actblock', 'Block', 'Block', in_arrayi('Block', $Include_Act)));
    $group->add(new Form_Input('filterlogentries_interfaces', null, 'text', $filterfieldsarray['interface']))->setHelp('Interface');
    $group->add(new Form_Input('filterlogentries_destinationport', null, 'text', $filterfieldsarray['dstport']))->setHelp('Destination Port');
    $group->add(new Form_Input('filterlogentries_protocolflags', null, 'text', $filterfieldsarray['tcpflags']))->setHelp('Protocol Flags');
} else {
    // Simple log filter form
    $form = new Form(new Form_Button('filtersubmit', 'Filter'));
    $section = new Form_Section('Log Filter');
    $section->addInput(new Form_Select('filterdescriptions', 'Where to show rule descriptions', $interfacefilter, build_if_list()));
    $group = new Form_Group('');
    $group->add(new Form_Input('filtertext', null, 'text', $filtertext))->setHelp('Filter Expression');
    $group->add(new Form_Input('filterlogentries_qty', null, 'text', $filterlogentries_qty))->setHelp('Quantity');
}
$group->setHelp('<a target="_blank" href="http://www.php.net/manual/en/book.pcre.php">' . 'Regular expression reference</a> Precede with exclamation (!) to exclude match.');
$section->add($group);
$form->add($section);
Beispiel #10
0
    xml_set_character_data_handler($xml_parser, "contents");
    // read the file
    $data = file_get_contents($filename);
    // parse the file
    xml_parse($xml_parser, $data);
    // free the xml parser
    xml_parser_free($xml_parser);
}
// for each result, split it in to words, and for each word increase that words count
while ($row = mysql_fetch_array($result)) {
    $words = preg_split("/[^a-zA-Z]+/", $row['why']);
    foreach ($words as $word) {
        $word = strtolower(stripslashes(trim($word)));
        // if the word is in our filter array
        // we will not include it in the count
        if (strlen($word) > 1 && strlen($word) < $wordLength && !in_arrayi($word, $filterWords)) {
            // checks if the array index exists and if it does increment the value
            $word = " " . $word;
            if (isset($counts[$word])) {
                $counts[$word]++;
            } else {
                $counts[$word] = 1;
            }
        }
    }
}
arsort($counts);
if ($json_output) {
    echo json_encode(array('tags' => $counts));
} else {
    foreach ($counts as $word => $count) {
 public function testInArrayI()
 {
     $array = ['ab', 'cd', 'EF', "GH"];
     $this->assertTrue(in_arrayi('ab', $array));
     $this->assertTrue(in_arrayi('ef', $array));
     $this->assertTrue(in_arrayi('CD', $array));
     $this->assertFalse(in_arrayi('ij', $array));
 }
             foreach ($index_liste as $key_liste => $element_liste) {
                 if (in_arrayi($element_liste, $valeur_selection)) {
                     $valeurs_fiche['lien_voir_titre'] = '<a class="BAZ_lien_modifier" href="' . $this->href('', $valeurs_fiche['id_fiche']) . '" title="Voir la fiche">' . $valeurs_fiche['bf_titre'] . '</a>' . "\n";
                     $valeurs_fiche['lien_voir'] = '<a class="BAZ_lien_modifier" href="' . $this->href('', $valeurs_fiche['id_fiche']) . '" title="Voir la fiche"></a>' . "\n";
                     $facettes['fiches'][$valeurs_fiche['id_fiche']] = $valeurs_fiche;
                     $facettes['html'] = baz_voir_fiche(0, $valeurs_fiche);
                 }
             }
             if (isset($valeurs_fiche['ficheliees'])) {
                 foreach ($valeurs_fiche['ficheliees'] as $valeurs_fiche_liee) {
                     $index_liste = explode(",", $valeurs_fiche_liee['checkbox' . $key_selection]);
                     if (empty($index_liste[0])) {
                         $index_liste = explode(",", $valeurs_fiche_liee['liste' . $key_selection]);
                     }
                     foreach ($index_liste as $key_liste => $element_liste) {
                         if (in_arrayi($element_liste, $valeur_selection)) {
                             $facettes['fiches'][$valeurs_fiche['id_fiche']]['ficheliees'][$valeurs_fiche_liee['id_fiche']] = $valeurs_fiche_liee;
                         }
                     }
                 }
             }
         }
     }
 } else {
     // Pas de selections : on affiche toutes les fiches TODO : pagination
     $valeurs_fiche['lien_voir_titre'] = '<a class="BAZ_lien_modifier" href="' . $this->href('', $valeurs_fiche['id_fiche']) . '" title="Voir la fiche">' . $valeurs_fiche['bf_titre'] . '</a>' . "\n";
     $valeurs_fiche['lien_voir'] = '<a class="BAZ_lien_modifier" href="' . $this->href('', $valeurs_fiche['id_fiche']) . '" title="Voir la fiche"></a>' . "\n";
     $valeurs_fiche['categorie'] = "";
     // On renseigne les categories pour de l'eventuel Facet Javascript.
     foreach ($groups as $group) {
         $group = preg_replace('/\\*/', '', $group);
Beispiel #13
0
    }
    $ufile = 'cp_settings.xml';
    undo($ufile, $path, $bakpath);
    redirect('support.php?rest=true');
}
if (isset($_GET['restored'])) {
    $restored = 'true';
} else {
    $restored = 'false';
}
# were changes submitted?
if (isset($_POST['submitted'])) {
    $success = i18n_r('SETTINGS_UPDATED') . '. <a href="support.php?undo&nonce=' . get_nonce("restore", "support.php") . '">' . i18n_r('UNDO') . '</a>';
}
$php_modules = get_loaded_extensions();
if (in_arrayi('curl', $php_modules)) {
    $curl_URL = $api_url . '?v=' . $site_version_no;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_TIMEOUT, 2);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_URL, $curl_URL);
    $data = curl_exec($ch);
    curl_close($ch);
    if ($data !== false) {
        $apikey = json_decode($data);
        $verstatus = $apikey->status;
    } else {
        $apikey = null;
        $verstatus = null;
    }
} else {
function validate_safe_file($file, $name, $mime)
{
    global $mime_type_blacklist;
    global $file_ext_blacklist;
    $file_extention = pathinfo($name, PATHINFO_EXTENSION);
    $file_mime_type = $mime;
    if (in_arrayi($file_mime_type, $mime_type_blacklist)) {
        return false;
    } elseif (in_arrayi($file_extention, $file_ext_blacklist)) {
        return false;
    } else {
        return true;
    }
}
Beispiel #15
0
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<title>Minimum Buttons</title> 
<meta name="description" content="Minimum Buttons." /> 
<meta name="keywords" content="minimum, buttons" /> 
<meta name="author" content="Brandon Evans" /> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
</head>
<body>
<?php 
if ($_POST['submit']) {
    $type = explode('.', $_FILES['file']['name']);
    $type = $type[count($type) - 1];
    if (!in_arrayi($type, $types)) {
        ?>
<p>The provided file is an unsupported type.</p>
<?php 
    } else {
        $file = file_get_contents($_FILES['file']['tmp_name']);
        $frames = 0;
        $holds = 0;
        $last = array();
        $presses = 0;
        foreach (preg_split("/(\r?\n)/", $file) as $line) {
            // This is only a frame if it starts with a vertical bar.
            if ($line[0] == '|') {
                $frames++;
                $players = array();
                // Split up the sections by a vertical bar.
    // Advanced log filter form
    $form = new Form(false);
    $section = new Form_Section('Advanced Log Filter', 'adv-filter-panel', COLLAPSIBLE | $filter_state);
    $group = new Form_Group('');
    $group->add(new Form_Input('filterlogentries_sourceipaddress', null, 'text', $filterfieldsarray['srcip']))->setHelp('Source IP Address');
    $group->add(new Form_Input('filterlogentries_destinationipaddress', null, 'text', $filterfieldsarray['dstip']))->setHelp('Destination IP Address');
    $section->add($group);
    $group = new Form_Group('');
    $group->add(new Form_Checkbox('actpass', null, 'Pass', in_arrayi('Pass', $Include_Act), 'Pass'))->setWidth(1);
    $group->add(new Form_Input('filterlogentries_time', null, 'text', $filterfieldsarray['time']))->setWidth(3)->setHelp('Time');
    $group->add(new Form_Input('filterlogentries_sourceport', null, 'text', $filterfieldsarray['srcport']))->setWidth(2)->setHelp('Source Port');
    $group->add(new Form_Input('filterlogentries_protocol', null, 'text', $filterfieldsarray['proto']))->setWidth(2)->setHelp('Protocol');
    $group->add(new Form_Input('filterlogentries_qty', null, 'number', $filterlogentries_qty, ['placeholder' => $nentries]))->setWidth(2)->setHelp('Quantity');
    $section->add($group);
    $group = new Form_Group('');
    $group->add(new Form_Checkbox('actblock', null, 'Block', in_arrayi('Block', $Include_Act), 'Block'))->setWidth(1);
    $group->add(new Form_Input('filterlogentries_interfaces', null, 'text', $filterfieldsarray['interface']))->setWidth(2)->setHelp('Interface');
    $group->add(new Form_Input('filterlogentries_destinationport', null, 'text', $filterfieldsarray['dstport']))->setWidth(2)->setHelp('Destination Port');
    $group->add(new Form_Input('filterlogentries_protocolflags', null, 'text', $filterfieldsarray['tcpflags']))->setWidth(2)->setHelp('Protocol Flags');
    $btnsubmit = new Form_Button('filterlogentries_submit', ' ' . gettext('Apply Filter'), null, 'fa-filter');
} else {
    // Simple log filter form
    $form = new Form(false);
    $section = new Form_Section('Log Filter', 'basic-filter-panel', COLLAPSIBLE | $filter_state);
    $group = new Form_Group('');
    $group->add(new Form_Select('interface', null, $interfacefilter, build_if_list()))->setWidth(2)->setHelp('Interface');
    $group->add(new Form_Input('filterlogentries_qty', null, 'number', $filterlogentries_qty, ['placeholder' => $nentries]))->setWidth(2)->setHelp('Quantity');
    $section->add($group);
    $group = new Form_Group('');
    $group->add(new Form_Input('filtertext', null, 'text', $filtertext))->setWidth(6)->setHelp('Filter Expression');
    $btnsubmit = new Form_Button('filtersubmit', ' ' . gettext('Apply Filter'), null, 'fa-filter');
 /**
  * @return bool true if binary is expected
  */
 private function prepareBinaryResponseAsDownload()
 {
     if ($this->requestMethod != 'GET' || preg_match("@\\w{4}0{3}\\w{8}([A-Z]{3})?/(Body|VersionData|ContentData|Document|Binary)\$@", $this->url) == 0) {
         return false;
     }
     $expUrl = explode("/", $this->url);
     $binIdPos = count($expUrl) - 2;
     $binId = $expUrl[$binIdPos];
     $binSobjectTypePos = count($expUrl) - 3;
     $binSobjectType = $expUrl[$binSobjectTypePos];
     // Handle the different fields that support binary data in their own special way.
     if (in_arrayi($binSobjectType, array("Document", "Attachment", "StaticResource"))) {
         $binInfo = new SObject(WorkbenchContext::get()->getPartnerConnection()->retrieve("Name, ContentType, BodyLength", $binSobjectType, $binId));
         $binFilename = $binInfo->fields->Name;
         $binContentType = $binInfo->fields->ContentType;
         $binContentLength = $binInfo->fields->BodyLength;
     } else {
         if ($binSobjectType == "ContentVersion") {
             $binInfo = new SObject(WorkbenchContext::get()->getPartnerConnection()->retrieve("PathOnClient, FileType, ContentSize", $binSobjectType, $binId));
             $binFilename = basename($binInfo->fields->PathOnClient);
             $binContentType = "application/" . $binInfo->fields->FileType;
             $binContentLength = $binInfo->fields->ContentSize;
         } else {
             if (stripos($this->url, "ContentData")) {
                 $binInfo = new SObject(WorkbenchContext::get()->getPartnerConnection()->retrieve("ContentFileName, ContentType, ContentSize", $binSobjectType, $binId));
                 $binFilename = $binInfo->fields->ContentFileName;
                 $binContentType = $binInfo->fields->ContentType;
                 $binContentLength = $binInfo->fields->ContentSize;
             } else {
                 if ($binSobjectType == "MailmergeTemplate") {
                     $binInfo = new SObject(WorkbenchContext::get()->getPartnerConnection()->retrieve("Filename, BodyLength", $binSobjectType, $binId));
                     $binFilename = $binInfo->fields->Filename;
                     $binContentType = "application/msword";
                     $binContentLength = $binInfo->fields->BodyLength;
                 } else {
                     if ($binSobjectType == "QuoteDocument") {
                         $binInfo = new SObject(WorkbenchContext::get()->getPartnerConnection()->retrieve("Name", $binSobjectType, $binId));
                         $binFilename = $binInfo->fields->Name;
                     } else {
                         return false;
                     }
                 }
             }
         }
     }
     header("Content-Disposition: attachment; filename=" . rawurlencode($binFilename));
     if (isset($binContentType)) {
         header("Content-Type: " . $binContentType);
     }
     if (isset($binContentLength)) {
         header("Content-Length: " . $binContentLength);
     }
     return true;
 }
Beispiel #18
0
function gs_anonymousdata()
{
    #grab data from this installation
    if (isset($_POST['preview'])) {
        global $LANG, $TIMEZONE, $SITEURL, $live_plugins, $thisfile_anony;
        $missing_modules = array();
        $php_modules = get_loaded_extensions();
        if (!in_arrayi('curl', $php_modules)) {
            $missing_modules[] = 'curl';
            $email_not_curl = true;
        } else {
            $email_not_curl = false;
        }
        if (!in_arrayi('gd', $php_modules)) {
            $missing_modules[] = 'GD';
        }
        if (!in_arrayi('zip', $php_modules)) {
            $missing_modules[] = 'ZipArchive';
        }
        if (!in_arrayi('SimpleXML', $php_modules)) {
            $missing_modules[] = 'SimpleXML';
        }
        if (function_exists('apache_get_modules')) {
            if (!in_arrayi('mod_rewrite', apache_get_modules())) {
                $missing_modules[] = 'mod_rewrite';
            }
        }
        $lastModified = @filemtime(GSDATAOTHERPATH . '.htaccess');
        if ($lastModified == NULL) {
            $lastModified = filemtime(utf8_decode(GSDATAOTHERPATH . '.htaccess'));
        }
        $preview_data = @new SimpleXMLExtended('<data></data>');
        $preview_data->addChild('submission_date', date('c'));
        $preview_data->addChild('getsimple_version', get_site_version(false));
        $preview_data->addChild('language', $LANG);
        $preview_data->addChild('timezone', $TIMEZONE);
        $preview_data->addChild('php_version', PHP_VERSION);
        $preview_data->addChild('server_type', PHP_OS);
        $preview_data->addChild('modules_missing', json_encode($missing_modules));
        $preview_data->addChild('number_pages', folder_items(GSDATAPAGESPATH) - 1);
        $preview_data->addChild('number_plugins', count($live_plugins));
        $preview_data->addChild('number_files', count(glob_recursive(GSDATAUPLOADPATH . '*')));
        $preview_data->addChild('number_themes', folder_items(GSTHEMESPATH));
        $preview_data->addChild('number_backups', count(getFiles(GSBACKUPSPATH . 'zip')));
        $preview_data->addChild('number_users', folder_items(GSUSERSPATH) - 1);
        $preview_data->addChild('domain_tld', get_tld_from_url($SITEURL));
        $preview_data->addChild('install_date', date('m-d-Y', $lastModified));
        $preview_data->addChild('category', $_POST['category']);
        $preview_data->addChild('link_back', $_POST['link_back']);
        XMLsave($preview_data, GSDATAOTHERPATH . 'anonymous_data.xml');
    }
    # post data to server
    if (isset($_POST['send'])) {
        global $thisfile_anony;
        $xml = file_get_contents(GSDATAOTHERPATH . 'anonymous_data.xml');
        $success = i18n_r($thisfile_anony . '/ANONY_SUCCESS');
        $php_modules = get_loaded_extensions();
        if (in_arrayi('curl', $php_modules)) {
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_TIMEOUT, 4);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_URL, 'http://get-simple.info/api/anonymous/?data=' . urlencode($xml));
            curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: text/xml'));
            $result = curl_exec($ch);
            curl_close($ch);
        } else {
            sendmail('*****@*****.**', 'Anonymous Data Submission', $xml);
        }
    }
    global $thisfile_anony;
    ?>
	<style>
		form#anondata p {margin-bottom:5px;}
		form#anondata label {display:block;width:220px;float:left;line-height:35px;}
		form#anondata select.text {width:auto;float:left;}
	</style>
	<h3><?php 
    i18n($thisfile_anony . '/ANONY_TITLE');
    ?>
</h3>
	
	<?php 
    if (isset($success)) {
        echo '<p style="color:#669933;"><b>' . $success . '</b></p>';
    }
    ?>
	
	<form method="post" id="anondata" action="<?php 
    echo $_SERVER['REQUEST_URI'];
    ?>
">
		
		<?php 
    if (isset($preview_data)) {
        ?>
			<p><?php 
        i18n($thisfile_anony . '/ANONY_CONFIRM');
        ?>
</p>
			<div class="unformatted"><code><?php 
        echo htmlentities(formatXmlString(file_get_contents(GSDATAOTHERPATH . 'anonymous_data.xml')));
        ?>
</code></div>
			<p class="submit"><br /><input type="submit" class="submit" value="<?php 
        i18n($thisfile_anony . '/ANONY_SEND_BTN');
        ?>
" name="send" /> &nbsp;&nbsp;<?php 
        i18n('OR');
        ?>
&nbsp;&nbsp; <a class="cancel" href="plugins.php?cancel"><?php 
        i18n('CANCEL');
        ?>
</a></p>		
		<?php 
    } else {
        ?>
 
			<p><?php 
        i18n($thisfile_anony . '/ANONY_PARAGRAPH');
        ?>
</p>
			<p><?php 
        i18n($thisfile_anony . '/ANONY_PARAGRAPH2');
        ?>
</p>
			<p class="clearfix" ><label><?php 
        i18n($thisfile_anony . '/ANONY_CATEGORY');
        ?>
:</label>
					<select name="category" class="text">
						<option value=""></option>
						<option value="Arts"><?php 
        i18n($thisfile_anony . '/ANONY_ARTS');
        ?>
</option>
						<option value="Business"><?php 
        i18n($thisfile_anony . '/ANONY_BUSINESS');
        ?>
</option>
						<option value="Children"><?php 
        i18n($thisfile_anony . '/ANONY_CHILDREN');
        ?>
</option>
						<option value="Computer &amp; Internet"><?php 
        i18n($thisfile_anony . '/ANONY_INTERNET');
        ?>
</option>
						<option value="Culture &amp; Religion"><?php 
        i18n($thisfile_anony . '/ANONY_RELIGION');
        ?>
</option>
						<option value="Education"><?php 
        i18n($thisfile_anony . '/ANONY_EDUCATION');
        ?>
</option>
						<option value="Employment"><?php 
        i18n($thisfile_anony . '/ANONY_EMPLOYMENT');
        ?>
</option>
						<option value="Entertainment"><?php 
        i18n($thisfile_anony . '/ANONY_ENTERTAINMENT');
        ?>
</option>
						<option value="Money &amp; Finance"><?php 
        i18n($thisfile_anony . '/ANONY_FINANCE');
        ?>
</option>
						<option value="Food"><?php 
        i18n($thisfile_anony . '/ANONY_FOOD');
        ?>
</option>
						<option value="Games"><?php 
        i18n($thisfile_anony . '/ANONY_GAMES');
        ?>
</option>
						<option value="Government"><?php 
        i18n($thisfile_anony . '/ANONY_GOVERNMENT');
        ?>
</option>
						<option value="Health &amp; Fitness"><?php 
        i18n($thisfile_anony . '/ANONY_HEALTHFITNESS');
        ?>
</option>
						<option value="HighTech"><?php 
        i18n($thisfile_anony . '/ANONY_HIGHTECH');
        ?>
</option>
						<option value="Hobbies &amp; Interests"><?php 
        i18n($thisfile_anony . '/ANONY_HOBBIES');
        ?>
</option>
						<option value="Law"><?php 
        i18n($thisfile_anony . '/ANONY_LAW');
        ?>
</option>
						<option value="Life Family Issues"><?php 
        i18n($thisfile_anony . '/ANONY_LIFEFAMILY');
        ?>
</option>
						<option value="Marketing"><?php 
        i18n($thisfile_anony . '/ANONY_MARKETING');
        ?>
</option>
						<option value="Media"><?php 
        i18n($thisfile_anony . '/ANONY_MEDIA');
        ?>
</option>
						<option value="Misc"><?php 
        i18n($thisfile_anony . '/ANONY_MISC');
        ?>
</option>
						<option value="Movies &amp; Television"><?php 
        i18n($thisfile_anony . '/ANONY_MOVIES');
        ?>
</option>
						<option value="Music &amp; Radio"><?php 
        i18n($thisfile_anony . '/ANONY_MUSIC');
        ?>
</option>
						<option value="Nature"><?php 
        i18n($thisfile_anony . '/ANONY_NATURE');
        ?>
</option>
						<option value="Non-Profit"><?php 
        i18n($thisfile_anony . '/ANONY_NONPROFIT');
        ?>
</option>
						<option value="Personal Homepages"><?php 
        i18n($thisfile_anony . '/ANONY_PERSONAL');
        ?>
</option>
						<option value="Pets"><?php 
        i18n($thisfile_anony . '/ANONY_PETS');
        ?>
</option>
						<option value="Home &amp; Garden"><?php 
        i18n($thisfile_anony . '/ANONY_HOMEGARDEN');
        ?>
</option>
						<option value="Real Estate"><?php 
        i18n($thisfile_anony . '/ANONY_REALESTATE');
        ?>
</option>
						<option value="Science &amp; Technology"><?php 
        i18n($thisfile_anony . '/ANONY_SCIENCE');
        ?>
</option>
						<option value="Shopping &amp; Services"><?php 
        i18n($thisfile_anony . '/ANONY_SHOPPING');
        ?>
</option>
						<option value="Society"><?php 
        i18n($thisfile_anony . '/ANONY_SOCIETY');
        ?>
</option>
						<option value="Sports"><?php 
        i18n($thisfile_anony . '/ANONY_SPORTS');
        ?>
</option>
						<option value="Tourism"><?php 
        i18n($thisfile_anony . '/ANONY_TOURISM');
        ?>
</option>
						<option value="Transportation"><?php 
        i18n($thisfile_anony . '/ANONY_TRANSPORTATION');
        ?>
</option>
						<option value="Travel"><?php 
        i18n($thisfile_anony . '/ANONY_TRAVEL');
        ?>
</option>
						<option value="X-rated"><?php 
        i18n($thisfile_anony . '/ANONY_XRATED');
        ?>
</option>
					</select>
			</p>
			<p class="clearfix" ><label><?php 
        i18n($thisfile_anony . '/ANONY_LINK');
        ?>
</label><select class="text" name="link_back"><option></option><option value="yes" ><?php 
        i18n($thisfile_anony . '/ANONY_YES');
        ?>
</option><option value="no" ><?php 
        i18n($thisfile_anony . '/ANONY_NO');
        ?>
</option></select></p>
			<p style="color:#cc0000;font-size:11px;" >* <?php 
        i18n($thisfile_anony . '/ANONY_DISCLAIMER');
        ?>
</p>
			<p class="submit"><br /><input type="submit" class="submit" value="<?php 
        i18n($thisfile_anony . '/ANONY_PREVIEW_BTN');
        ?>
" name="preview" /> &nbsp;&nbsp;<?php 
        i18n('OR');
        ?>
&nbsp;&nbsp; <a class="cancel" href="plugins.php?cancel"><?php 
        i18n('CANCEL');
        ?>
</a></p>
		<?php 
    }
    ?>
	</form>

	<?php 
}
Beispiel #19
0
 private function ManageOrders($MsgDesc = "", $MsgStatus = "")
 {
     $GLOBALS['HideClearResults'] = "none";
     $status = array();
     $num_custom_searches = 0;
     $numOrders = 0;
     // Fetch any results, place them in the data grid
     $GLOBALS['OrderDataGrid'] = $this->ManageOrdersGrid($numOrders);
     // Was this an ajax based sort? Return the table now
     if (isset($_REQUEST['ajax']) && $_REQUEST['ajax'] == 1) {
         echo $GLOBALS['OrderDataGrid'];
         return;
     }
     if (isset($_REQUEST['searchQuery']) || isset($_GET['searchId'])) {
         $GLOBALS['HideClearResults'] = "";
     }
     if (isset($this->_customSearch['searchname'])) {
         $GLOBALS['ViewName'] = $this->_customSearch['searchname'];
     } else {
         $GLOBALS['ViewName'] = GetLang('AllOrders');
         $GLOBALS['HideDeleteViewLink'] = "none";
     }
     // Do we display the add order buton?
     if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Add_Orders)) {
         $GLOBALS['AddOrderButton'] = '<input type="button" value="' . GetLang('AddAnOrder') . '..." class="FormButton" style="width:100px" onclick="document.location.href=\'index.php?ToDo=addOrder\'" /><br /><br />';
     } else {
         $GLOBALS['AddOrderButton'] = '';
     }
     $GLOBALS['OrderActionOptions'] = '<option selected="1">' . GetLang('ChooseAction') . '</option>';
     // Do we need to disable the delete button?
     if (!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Delete_Orders) || $numOrders == 0) {
         $args = 'disabled="1"';
     } else {
         $args = 'value="delete"';
     }
     $GLOBALS['OrderActionOptions'] .= '<option ' . $args . '>' . GetLang('DeleteSelected') . '</option>';
     if ($numOrders > 0) {
         if ($MsgDesc == "" && (isset($_REQUEST['searchQuery']) || isset($_GET['searchId']) || count($_GET) > 1)) {
             if ($numOrders == 1) {
                 $MsgDesc = GetLang('OrderSearchResultsBelow1');
             } else {
                 $MsgDesc = sprintf(GetLang('OrderSearchResultsBelowX'), $numOrders);
             }
             $MsgStatus = MSG_SUCCESS;
         }
         $args1 = 'value="printInvoice"';
         $args2 = 'value="printSlip"';
     } else {
         $args1 = 'disabled="1"';
         $args2 = 'disabled="1"';
     }
     $GLOBALS['OrderActionOptions'] .= '<option ' . $args1 . '>' . GetLang('PrintInvoicesSelected') . '</option>';
     $GLOBALS['OrderActionOptions'] .= '<option ' . $args2 . '>' . GetLang('PrintPackingSlipsSelected') . '</option>';
     if (!gzte11(ISC_MEDIUMPRINT)) {
         $GLOBALS[base64_decode('SGlkZUV4cG9ydA==')] = "none";
     } else {
         // Do we need to disable the export button?
         if (!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Export_Orders) || $numOrders == 0) {
             $args = 'disabled="1"';
         } else {
             $args = 'value="export"';
         }
         $GLOBALS['OrderActionOptions'] .= '<option ' . $args . '>' . GetLang('ExportOrders') . '</option>';
         //$GLOBALS['OrderActionOptions'] .= '<option ' . $args . '>' . 'Send Review Request' . '</option>';
     }
     //zfang
     //$GLOBALS['OrderActionOptions'] .= '<option ' . $args . '>' . 'Send Review Request' . '</option>';
     $GLOBALS['OrderActionOptions'] .= '<option value="sendOrdReviewReq">' . GetLang('SendReviewRequest') . '</option>';
     $GLOBALS['OrderActionOptions'] .= '<option disabled="1"></option><optgroup label="' . GetLang('BulkOrderStatus') . '">';
     $result = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]order_status where statusid!=0 ORDER BY statusorder ASC");
     while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
         $GLOBALS['OrderActionOptions'] .= '<option value="updateStatus' . $row['statusid'] . '">' . $row['statusdesc'] . '</option>';
     }
     $GLOBALS['OrderActionOptions'] .= '</optgroup>';
     if (!isset($_REQUEST['searchId'])) {
         $_REQUEST['searchId'] = 0;
     }
     // Get the custom search as option fields
     $GLOBALS['CustomSearchOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CUSTOMSEARCH']->GetSearchesAsOptions($_REQUEST['searchId'], $num_custom_searches, "AllOrders", "viewOrders", "customOrderSearch");
     if (!isset($_REQUEST['searchId'])) {
         $GLOBALS['HideDeleteCustomSearch'] = "none";
     } else {
         $GLOBALS['CustomSearchId'] = (int) $_REQUEST['searchId'];
     }
     $GLOBALS['OrderIntro'] = GetLang('ManageOrdersIntro');
     $GLOBALS['Message'] = '';
     // No orders
     if ($numOrders == 0) {
         $GLOBALS['DisplayGrid'] = "none";
         // Performing a search of some kind
         if (count($_GET) > 1) {
             if ($MsgDesc == "") {
                 $GLOBALS['Message'] = MessageBox(GetLang('NoOrderResults'), MSG_ERROR);
             }
         } else {
             $GLOBALS['Message'] = MessageBox(GetLang('NoOrders'), MSG_SUCCESS);
             $GLOBALS['DisplaySearch'] = "none";
         }
     }
     if ($MsgDesc != "") {
         $GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
     }
     $flashMessages = GetFlashMessages();
     if (is_array($flashMessages)) {
         foreach ($flashMessages as $flashMessage) {
             $GLOBALS['Message'] .= MessageBox($flashMessage['message'], $flashMessage['type']);
         }
     }
     $GLOBALS['ExportAction'] = "index.php?ToDo=startExport&t=orders";
     if (isset($GLOBALS['CustomSearchId']) && $GLOBALS['CustomSearchId'] != '0') {
         $GLOBALS['ExportAction'] .= "&searchId=" . $GLOBALS['CustomSearchId'];
     } else {
         $query_params = explode('&', $_SERVER['QUERY_STRING']);
         $params = array();
         $ignore = array("ToDo");
         foreach ($query_params as $param) {
             $arr = explode("=", $param);
             if (!in_arrayi($arr[0], $ignore)) {
                 $params[$arr[0]] = $arr[1];
             }
         }
         if (count($params)) {
             $GLOBALS['ExportAction'] .= "&" . http_build_query($params);
         }
     }
     // Used for iPhone interface
     $GLOBALS['OrderStatusOptions'] = $this->GetOrderStatusOptions();
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("orders.manage");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
     echo $GLOBALS['ISC_CLASS_DB']->GetErrorMsg();
 }
Beispiel #20
0
///////////////////////////////////////////////
echo '<h3>' . i18n_r('SERVER_SETUP') . '</h3>
			<table class="highlight healthcheck">
				<tr>';
echo '<td class="hc_item">PHP ' . i18n_r('VERSION') . '</td>';
if (version_compare(PHP_VERSION, "5.2", "<")) {
    echo '<td><span class="ERRmsg"><b>' . PHP_VERSION . '</b><br/>PHP 5.2 ' . i18n_r('OR_GREATER_REQ') . '</span></td><td><span class="label label-error">' . i18n_r('ERROR') . '</span></td>';
    $errorCnt++;
} else {
    echo '<td><b>' . PHP_VERSION . '</b></td><td><span class="label label-ok">' . i18n_r('OK') . '</span></td>';
}
echo '</tr>';
$apacheModules = array("curl|cURL Module|warn", "gd|GD Library|warn", "zip|ZipArchive|warn", "SimpleXML|SimpleXML Module|error");
foreach ($apacheModules as $module) {
    list($mId, $mTitle, $mAlert) = explode('|', $module);
    if (in_arrayi($mId, $php_modules)) {
        echo '<tr><td class="hc_item">' . $mTitle . '</td><td>' . i18n_r('INSTALLED') . '</td><td><span class="label label-ok">' . i18n_r('OK') . '</span></td></tr>';
    } else {
        if ($mAlert == "warn") {
            echo '<tr><td class="hc_item">' . $mTitle . '</td><td><span class="WARNmsg">' . i18n_r('NOT_INSTALLED') . '</span></td><td><span class="label label-warn">' . i18n_r('WARNING') . '</span></td></tr>';
        } else {
            if ($mAlert == "error") {
                echo '<tr><td class="hc_item">' . $mTitle . '</td><td><span class="ERRmsg" >' . i18n_r('NOT_INSTALLED') . '</span></td><td><span class="label label-error">' . i18n_r('ERROR') . '</span></td></tr>';
                $errorCnt++;
            }
        }
    }
}
if (!function_exists('chmod')) {
    echo '<tr><td>chmod</td><td>' . i18n_r('NOT_INSTALLED') . '</td><td><span class="label label-warn">' . i18n_r('ERROR') . '</span></td></tr>';
} else {
 function get()
 {
     if (get_config('system', 'block_public') && !local_channel() && !remote_channel()) {
         notice(t('Public access denied.') . EOL);
         return;
     }
     $observer = get_observer_hash();
     $globaldir = get_directory_setting($observer, 'globaldir');
     // override your personal global search pref if we're doing a navbar search of the directory
     if (intval($_REQUEST['navsearch'])) {
         $globaldir = 1;
     }
     $safe_mode = get_directory_setting($observer, 'safemode');
     $pubforums = get_directory_setting($observer, 'pubforums');
     $o = '';
     nav_set_selected('directory');
     if (x($_POST, 'search')) {
         $search = notags(trim($_POST['search']));
     } else {
         $search = x($_GET, 'search') ? notags(trim(rawurldecode($_GET['search']))) : '';
     }
     if (strpos($search, '=') && local_channel() && get_pconfig(local_channel(), 'feature', 'expert')) {
         $advanced = $search;
     }
     $keywords = $_GET['keywords'] ? $_GET['keywords'] : '';
     // Suggest channels if no search terms or keywords are given
     $suggest = local_channel() && x($_REQUEST, 'suggest') ? $_REQUEST['suggest'] : '';
     if ($suggest) {
         $r = suggestion_query(local_channel(), get_observer_hash());
         // Remember in which order the suggestions were
         $addresses = array();
         $common = array();
         $index = 0;
         foreach ($r as $rr) {
             $common[$rr['xchan_addr']] = $rr['total'];
             $addresses[$rr['xchan_addr']] = $index++;
         }
         // Build query to get info about suggested people
         $advanced = '';
         foreach (array_keys($addresses) as $address) {
             $advanced .= "address=\"{$address}\" ";
         }
         // Remove last space in the advanced query
         $advanced = rtrim($advanced);
     }
     $tpl = get_markup_template('directory_header.tpl');
     $dirmode = intval(get_config('system', 'directory_mode'));
     if ($dirmode == DIRECTORY_MODE_PRIMARY || $dirmode == DIRECTORY_MODE_STANDALONE) {
         $url = z_root() . '/dirsearch';
     }
     if (!$url) {
         $directory = find_upstream_directory($dirmode);
         if (!$directory || !array_key_exists('url', $directory) || !$directory['url']) {
             logger('CRITICAL: No directory server URL');
         }
         $url = $directory['url'] . '/dirsearch';
     }
     $token = get_config('system', 'realm_token');
     logger('mod_directory: URL = ' . $url, LOGGER_DEBUG);
     $contacts = array();
     if (local_channel()) {
         $x = q("select abook_xchan from abook where abook_channel = %d", intval(local_channel()));
         if ($x) {
             foreach ($x as $xx) {
                 $contacts[] = $xx['abook_xchan'];
             }
         }
     }
     if ($url) {
         $numtags = get_config('system', 'directorytags');
         $kw = intval($numtags) > 0 ? intval($numtags) : 50;
         if (get_config('system', 'disable_directory_keywords')) {
             $kw = 0;
         }
         $query = $url . '?f=&kw=' . $kw . ($safe_mode != 1 ? '&safe=' . $safe_mode : '');
         if ($token) {
             $query .= '&t=' . $token;
         }
         if (!$globaldir) {
             $query .= '&hub=' . \App::get_hostname();
         }
         if ($search) {
             $query .= '&name=' . urlencode($search) . '&keywords=' . urlencode($search);
         }
         if (strpos($search, '@')) {
             $query .= '&address=' . urlencode($search);
         }
         if ($keywords) {
             $query .= '&keywords=' . urlencode($keywords);
         }
         if ($advanced) {
             $query .= '&query=' . urlencode($advanced);
         }
         if (!is_null($pubforums)) {
             $query .= '&pubforums=' . intval($pubforums);
         }
         $directory_sort_order = get_config('system', 'directory_sort_order');
         if (!$directory_sort_order) {
             $directory_sort_order = 'date';
         }
         $sort_order = x($_REQUEST, 'order') ? $_REQUEST['order'] : $directory_sort_order;
         if ($sort_order) {
             $query .= '&order=' . urlencode($sort_order);
         }
         if (\App::$pager['page'] != 1) {
             $query .= '&p=' . \App::$pager['page'];
         }
         logger('mod_directory: query: ' . $query);
         $x = z_fetch_url($query);
         logger('directory: return from upstream: ' . print_r($x, true), LOGGER_DATA);
         if ($x['success']) {
             $t = 0;
             $j = json_decode($x['body'], true);
             if ($j) {
                 if ($j['results']) {
                     $entries = array();
                     $photo = 'thumb';
                     foreach ($j['results'] as $rr) {
                         $profile_link = chanlink_url($rr['url']);
                         $pdesc = $rr['description'] ? $rr['description'] . '<br />' : '';
                         $connect_link = local_channel() ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : '';
                         // Checking status is disabled ATM until someone checks the performance impact more carefully
                         //$online = remote_online_status($rr['address']);
                         $online = '';
                         if (in_array($rr['hash'], $contacts)) {
                             $connect_link = '';
                         }
                         $location = '';
                         if (strlen($rr['locale'])) {
                             $location .= $rr['locale'];
                         }
                         if (strlen($rr['region'])) {
                             if (strlen($rr['locale'])) {
                                 $location .= ', ';
                             }
                             $location .= $rr['region'];
                         }
                         if (strlen($rr['country'])) {
                             if (strlen($location)) {
                                 $location .= ', ';
                             }
                             $location .= $rr['country'];
                         }
                         $age = '';
                         if (strlen($rr['birthday'])) {
                             if (($years = age($rr['birthday'], 'UTC', '')) != 0) {
                                 $age = $years;
                             }
                         }
                         $page_type = '';
                         if ($rr['total_ratings']) {
                             $total_ratings = sprintf(tt("%d rating", "%d ratings", $rr['total_ratings']), $rr['total_ratings']);
                         } else {
                             $total_ratings = '';
                         }
                         $profile = $rr;
                         if (x($profile, 'locale') == 1 || x($profile, 'region') == 1 || x($profile, 'postcode') == 1 || x($profile, 'country') == 1) {
                             $gender = x($profile, 'gender') == 1 ? t('Gender: ') . $profile['gender'] : False;
                         }
                         $marital = x($profile, 'marital') == 1 ? t('Status: ') . $profile['marital'] : False;
                         $homepage = x($profile, 'homepage') == 1 ? t('Homepage: ') : False;
                         $homepageurl = x($profile, 'homepage') == 1 ? $profile['homepage'] : '';
                         $hometown = x($profile, 'hometown') == 1 ? $profile['hometown'] : False;
                         $about = x($profile, 'about') == 1 ? bbcode($profile['about']) : False;
                         $keywords = x($profile, 'keywords') ? $profile['keywords'] : '';
                         $out = '';
                         if ($keywords) {
                             $keywords = str_replace(',', ' ', $keywords);
                             $keywords = str_replace('  ', ' ', $keywords);
                             $karr = explode(' ', $keywords);
                             if ($karr) {
                                 if (local_channel()) {
                                     $r = q("select keywords from profile where uid = %d and is_default = 1 limit 1", intval(local_channel()));
                                     if ($r) {
                                         $keywords = str_replace(',', ' ', $r[0]['keywords']);
                                         $keywords = str_replace('  ', ' ', $keywords);
                                         $marr = explode(' ', $keywords);
                                     }
                                 }
                                 foreach ($karr as $k) {
                                     if (strlen($out)) {
                                         $out .= ', ';
                                     }
                                     if ($marr && in_arrayi($k, $marr)) {
                                         $out .= '<strong>' . $k . '</strong>';
                                     } else {
                                         $out .= $k;
                                     }
                                 }
                             }
                         }
                         $entry = array('id' => ++$t, 'profile_link' => $profile_link, 'public_forum' => $rr['public_forum'], 'photo' => $rr['photo'], 'hash' => $rr['hash'], 'alttext' => $rr['name'] . (local_channel() || remote_channel() ? ' ' . $rr['address'] : ''), 'name' => $rr['name'], 'age' => $age, 'age_label' => t('Age:'), 'profile' => $profile, 'address' => $rr['address'], 'nickname' => substr($rr['address'], 0, strpos($rr['address'], '@')), 'location' => $location, 'location_label' => t('Location:'), 'gender' => $gender, 'total_ratings' => $total_ratings, 'viewrate' => true, 'canrate' => local_channel() ? true : false, 'pdesc' => $pdesc, 'pdesc_label' => t('Description:'), 'marital' => $marital, 'homepage' => $homepage, 'homepageurl' => linkify($homepageurl), 'hometown' => $hometown, 'hometown_label' => t('Hometown:'), 'about' => $about, 'about_label' => t('About:'), 'conn_label' => t('Connect'), 'forum_label' => t('Public Forum:'), 'connect' => $connect_link, 'online' => $online, 'kw' => $out ? t('Keywords: ') : '', 'keywords' => $out, 'ignlink' => $suggest ? z_root() . '/directory?ignore=' . $rr['hash'] : '', 'ignore_label' => t('Don\'t suggest'), 'common_friends' => $common[$rr['address']] ? intval($common[$rr['address']]) : '', 'common_label' => t('Common connections:'), 'common_count' => intval($common[$rr['address']]), 'safe' => $safe_mode);
                         $arr = array('contact' => $rr, 'entry' => $entry);
                         call_hooks('directory_item', $arr);
                         unset($profile);
                         unset($location);
                         if (!$arr['entry']) {
                             continue;
                         }
                         if ($sort_order == '' && $suggest) {
                             $entries[$addresses[$rr['address']]] = $arr['entry'];
                             // Use the same indexes as originally to get the best suggestion first
                         } else {
                             $entries[] = $arr['entry'];
                         }
                     }
                     ksort($entries);
                     // Sort array by key so that foreach-constructs work as expected
                     if ($j['keywords']) {
                         \App::$data['directory_keywords'] = $j['keywords'];
                     }
                     logger('mod_directory: entries: ' . print_r($entries, true), LOGGER_DATA);
                     if ($_REQUEST['aj']) {
                         if ($entries) {
                             $o = replace_macros(get_markup_template('directajax.tpl'), array('$entries' => $entries));
                         } else {
                             $o = '<div id="content-complete"></div>';
                         }
                         echo $o;
                         killme();
                     } else {
                         $maxheight = 94;
                         $dirtitle = $globaldir ? t('Global Directory') : t('Local Directory');
                         $o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; divmore_height = " . intval($maxheight) . ";  </script>";
                         $o .= replace_macros($tpl, array('$search' => $search, '$desc' => t('Find'), '$finddsc' => t('Finding:'), '$safetxt' => htmlspecialchars($search, ENT_QUOTES, 'UTF-8'), '$entries' => $entries, '$dirlbl' => $suggest ? t('Channel Suggestions') : $dirtitle, '$submit' => t('Find'), '$next' => alt_pager($a, $j['records'], t('next page'), t('previous page')), '$sort' => t('Sort options'), '$normal' => t('Alphabetic'), '$reverse' => t('Reverse Alphabetic'), '$date' => t('Newest to Oldest'), '$reversedate' => t('Oldest to Newest'), '$suggest' => $suggest ? '&suggest=1' : ''));
                     }
                 } else {
                     if ($_REQUEST['aj']) {
                         $o = '<div id="content-complete"></div>';
                         echo $o;
                         killme();
                     }
                     if (\App::$pager['page'] == 1 && $j['records'] == 0 && strpos($search, '@')) {
                         goaway(z_root() . '/chanview/?f=&address=' . $search);
                     }
                     info(t("No entries (some entries may be hidden).") . EOL);
                 }
             }
         }
     }
     return $o;
 }
Beispiel #22
0
function testExists()
{
    $arr = array();
    array_push($arr, "one");
    array_push($arr, "two");
    array_push($arr, "three");
    array_push($arr, "four");
    array_push($arr, "five");
    foreach ($arr as $h) {
        echo $h;
    }
    if (in_arrayi("ONE", $arr) == true) {
        echo " check: yes";
    } else {
        echo "wrong";
    }
}
Beispiel #23
0
echo $filterfieldsarray['proto'];
?>
"></td>
					          <td><input type="text" class="form-control" placeholder="<?php 
echo gettext('Quantity');
?>
" id="filterlogentries_qty" name="filterlogentries_qty" value="<?php 
echo $filterlogentries_qty;
?>
"></td>
					        </tr>
					        <tr>
					          <td>
						          <label class="__nowrap">
                                            <input id="actblock"  name="actblock"  type="checkbox" value="Block"  <?php 
if (in_arrayi('Block', $Include_Act)) {
    echo "checked=\"checked\"";
}
?>
 /> &nbsp;&nbsp;Block
                                          </label>
                                      </td>
					          <td><input type="text" class="form-control" placeholder="<?php 
echo gettext('Interface');
?>
" id="filterlogentries_interfaces" name="filterlogentries_interfaces" value="<?php 
echo $filterfieldsarray['interface'];
?>
"></td>
					          <td><input type="text" class="form-control" placeholder="<?php 
echo gettext('Destination IP Address');
Beispiel #24
0
    die('Images folder does not exist (update $images_folder in the script)');
}
if ($save_to_file && !file_exists($thumbs_folder)) {
    die('Thumbnails folder does not exist (update $thumbs_folder in the script)');
}
$dirs = explode('/', $path_parts['dirname']);
$folder = $thumbs_folder;
foreach ($dirs as $dir) {
    $folder .= DIRECTORY_SEPARATOR . $dir;
    if (!is_dir($folder)) {
        mkdir($folder);
    }
}
//gd check
$php_modules = get_loaded_extensions();
if (!in_arrayi('gd', $php_modules)) {
    die('GD not loaded, cannot generate thumbnail');
}
// Allocate all necessary memory for the image.
// Special thanks to Alecos for providing the code.
ini_set('memory_limit', '100M');
// include image processing code
include 'image.class.php';
$img = new Zubrag_image();
// initialize
$img->max_x = $max_x;
$img->max_y = $max_y;
$img->cut_x = $cut_x;
$img->cut_y = $cut_y;
$img->quality = $image_quality;
$img->save_to_file = $save_to_file;
 public function ManageProducts($MsgDesc = "", $MsgStatus = "")
 {
     # Used to clear the HTML Editor image upload folder name Baskaran
     $_SESSION['congobrand'] = '';
     $_SESSION['congoseries'] = '';
     //blessen
     if (isset($_GET['testdata']) and $_GET['testdata'] == "no") {
         unset($_SESSION['testmode']);
     }
     if ((isset($_GET['testdata']) and $_GET['testdata'] == "yes") || isset($_SESSION['testmode'])) {
         $GLOBALS['HideExportResults'] = "None";
         $GLOBALS['HideBulkExportButton'] = "None";
         $GLOBALS['HideExport'] = "None";
         $GLOBALS['ExportProductslan'] = "Show All Products";
         $GLOBALS['ShowtTestData'] = "index.php?ToDo=viewProducts&testdata=no";
         $_SESSION['testmode'] = "yes";
     } else {
         $vendorcondition = "";
         if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
             $vendorcondition .= " and prodvendorid = '" . $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId();
         }
         $query = sprintf("SELECT productid  FROM [|PREFIX|]products where testdata = 'Yes'  " . $vendorcondition . " ");
         $result = $GLOBALS["ISC_CLASS_DB"]->Query($query);
         if (mysql_num_rows($result) > 0) {
             $GLOBALS['ExportProductslan'] = "Show only test products";
             $GLOBALS['ShowtTestData'] = "index.php?ToDo=viewProducts&testdata=yes";
         } else {
             $GLOBALS['HideTestData'] = "None";
             unset($_SESSION['testmode']);
         }
     }
     //blessen
     $GLOBALS['HideClearResults'] = "none";
     $catList = "";
     $numProducts = 0;
     // Fetch any results, place them in the data grid
     $GLOBALS['ProductDataGrid'] = $this->ManageProductsGrid($numProducts);
     // Was this an ajax based sort? Return the table now
     if (isset($_REQUEST['ajax']) && $_REQUEST['ajax'] == 1) {
         echo $GLOBALS['ProductDataGrid'];
         return;
     }
     if (isset($this->_customSearch['searchname'])) {
         $GLOBALS['ViewName'] = $this->_customSearch['searchname'];
     } else {
         $GLOBALS['ViewName'] = GetLang('AllProducts');
         $GLOBALS['HideDeleteViewLink'] = "none";
     }
     $num_custom_searches = 0;
     if (!isset($_REQUEST['searchId'])) {
         $_REQUEST['searchId'] = 0;
     }
     // Get the custom search as option fields
     $GLOBALS['CustomSearchOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CUSTOMSEARCH']->GetSearchesAsOptions(@$_REQUEST['searchId'], $num_custom_searches, "AllProducts", "viewProducts", "customProductSearch");
     if (isset($_REQUEST['searchQuery'])) {
         $GLOBALS['HideClearResults'] = "";
     }
     if (!isset($_REQUEST['searchId']) || (int) $_REQUEST['searchId'] <= 0) {
         $GLOBALS['HideDeleteCustomSearch'] = "none";
     } else {
         $GLOBALS['CustomSearchId'] = (int) $_REQUEST['searchId'];
     }
     // Do we need to disable the delete button?
     if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Delete_Products) || $numProducts == 0) {
         $GLOBALS['DisableDelete'] = "DISABLED";
     }
     // Do we need to disable the expory button?
     if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Export_Products) || $numProducts == 0) {
         $GLOBALS['DisableExport'] = "DISABLED";
     }
     $GLOBALS['ProductIntro'] = GetLang('ManageProductsIntro');
     if ($numProducts > 0) {
         if ($MsgDesc == "" && (isset($_REQUEST['searchQuery']) || isset($_GET['searchId']) && $_GET['searchId'] > 0)) {
             if ($numProducts == 1) {
                 $MsgDesc = GetLang('ProductSearchResultsBelow1');
             } else {
                 $MsgDesc = sprintf(GetLang('ProductSearchResultsBelowX'), $numProducts);
             }
             $MsgStatus = MSG_SUCCESS;
         }
     } else {
         $GLOBALS['DisplayGrid'] = "none";
         if (count($_GET) > 1) {
             if ($MsgDesc == "") {
                 $GLOBALS['Message'] = MessageBox(GetLang('NoProductResults'), MSG_ERROR);
             }
         } else {
             // No actual custoemrs
             $GLOBALS['DisplaySearch'] = "none";
             $GLOBALS['Message'] = MessageBox(GetLang('NoProducts'), MSG_SUCCESS);
         }
     }
     if (!gzte11(ISC_MEDIUMPRINT)) {
         $GLOBALS[base64_decode('SGlkZUV4cG9ydA==')] = "none";
     }
     if (!gzte11(ISC_LARGEPRINT)) {
         $GLOBALS[base64_decode("SGlkZUJ1bGtFeHBvcnRCdXR0b24=")] = "none";
     }
     if ($MsgDesc != "") {
         $GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
     }
     $flashMessages = GetFlashMessages();
     if (is_array($flashMessages) || !empty($flashMessages)) {
         $GLOBALS['Message'] = '';
         foreach ($flashMessages as $flashMessage) {
             $GLOBALS['Message'] .= MessageBox($flashMessage['message'], $flashMessage['type']);
         }
     }
     // Do we have permission to bulk edit products?
     if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Products)) {
         $GLOBALS['DisableBulkEdit'] = "DISABLED='DISABLED'";
     }
     //blessen
     $GLOBALS['HideExportResults'] = "";
     if (!isset($_GET['searchQuery'])) {
         $GLOBALS['HideExportResults'] = "None";
     }
     $GLOBALS['ExportResults'] = "";
     $GLOBALS['ExportResults'] = "index.php?ToDo=startExport&t=products";
     if (!isset($_GET['searchQuery'])) {
         $GLOBALS['HideDeleteResults'] = "None";
     }
     //blessen
     $GLOBALS['ExportAction'] = "index.php?ToDo=startExport&t=products";
     if (isset($GLOBALS['CustomSearchId']) && $GLOBALS['CustomSearchId'] != '0') {
         $GLOBALS['ExportAction'] .= "&searchId=" . $GLOBALS['CustomSearchId'];
         $GLOBALS['ExportResults'] .= "&searchId=" . $GLOBALS['CustomSearchId'];
     } else {
         $query_params = explode('&', $_SERVER['QUERY_STRING']);
         $params = array();
         $ignore = array("ToDo");
         foreach ($query_params as $param) {
             $arr = explode("=", $param);
             if (!in_arrayi($arr[0], $ignore)) {
                 $params[$arr[0]] = $arr[1];
             }
         }
         if (count($params)) {
             $GLOBALS['ExportAction'] .= "&" . http_build_query($params);
             $GLOBALS['ExportResults'] .= "&" . http_build_query($params) . "&results=1";
         }
     }
     $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("products.manage");
     $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
 }
/**
 * generate a thumbnail
 * @param  str  $sub_path upload path
 * @param  str  $file     filename
 * @param  str  $out_file outfile name, can be null if show is true
 * @param  int  $w        desired width
 * @param  int  $h        desired max height, optional, will limit height and adjust width accordingly
 * @param  int  $quality  quality of image jpg and png
 * @param  bool $show     output to browser if true
 * @param  str $output_format optional output format, if not determining from out_file can be excusivly set (1|'GIF', 2|'JPG,'' 3|'PNG')
 * @param  boolean $upscale  true, allows image to scale up/zoom to fit thumbnail
 * @return bool            success
 */
function generate_thumbnail($file, $sub_path = '', $out_file = null, $w = null, $h = null, $crop = null, $quality = null, $show = false, $output_format = null, $upscale = false)
{
    //gd check, do nothing if no gd
    $php_modules = get_loaded_extensions();
    if (!in_arrayi('gd', $php_modules)) {
        return false;
    }
    $sub_path = tsl($sub_path);
    $upload_folder = GSDATAUPLOADPATH . $sub_path;
    $thumb_folder = GSTHUMBNAILPATH . $sub_path;
    $thumb_file = isset($out_file) && !empty($out_file) ? $thumb_folder . $out_file : '';
    create_dir($thumb_folder);
    require_once 'imagemanipulation.php';
    $objImage = new ImageManipulation($upload_folder . $file);
    if ($objImage->imageok) {
        if ($upscale) {
            $objImage->setUpscale();
        }
        // allow magnification
        if ($quality) {
            $objImage->setQuality($quality);
        }
        // set quality for jpg or png
        if (isset($output_format)) {
            $objImage->setOutputFormat($output_format);
        }
        // setoutput format, ignored if out_file specifies extension
        if (isset($w) && isset($h)) {
            $objImage->setImageWidth($w, $h);
        } elseif (isset($w)) {
            $objImage->setImageWidth($w);
            // if only specifiying width, scale to width only
            // $objImage->resize($w); // constrains both dimensions to $size, same as setImageWidth($w,$w);
        } elseif (isset($h)) {
            $objImage->setImageHeight($h);
            // if only specifiying width, scale to width only
        }
        if (isset($crop)) {
            $objImage->setAutoCrop($crop);
        }
        // die(print_r($objImage));
        $objImage->save($thumb_file, $show);
        return $objImage;
    } else {
        return false;
    }
}
Beispiel #27
0
/**
 * Returns status of mode rewrite via apache_get_modules 
 * or custom HTTP_MOD_REWRITE env set in .htaccess
 * @return bool true if on false if not, null if unknown
 */
function hasModRewrite()
{
    if (getenv('HTTP_MOD_REWRITE') == 'On') {
        return true;
    }
    if (function_exists('apache_get_modules')) {
        if (in_arrayi('mod_rewrite', apache_get_modules())) {
            return true;
        }
    }
}
Beispiel #28
0
/**
 * Generate standard thumbnails
 * @param  string $path path to image
 * @param  string $name file name
 * @uses   GD
 */
function genStdThumb($path, $name)
{
    //gd check
    $php_modules = get_loaded_extensions();
    if (!in_arrayi('gd', $php_modules)) {
        return;
    }
    if (!defined('GSIMAGEWIDTH')) {
        $width = 200;
        //New width of image
    } else {
        $width = GSIMAGEWIDTH;
    }
    $ext = lowercase(pathinfo($name, PATHINFO_EXTENSION));
    if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'gif' || $ext == 'png') {
        $thumbsPath = GSTHUMBNAILPATH . $path;
        if (!file_exists($thumbsPath)) {
            if (defined('GSCHMOD')) {
                $chmod_value = GSCHMOD;
            } else {
                $chmod_value = 0755;
            }
            mkdir($thumbsPath, $chmod_value);
        }
    }
    $targetFile = GSDATAUPLOADPATH . $path . $name;
    //thumbnail for post
    $imgsize = getimagesize($targetFile);
    switch ($ext) {
        case "jpeg":
        case "jpg":
            $image = imagecreatefromjpeg($targetFile);
            break;
        case "png":
            $image = imagecreatefrompng($targetFile);
            break;
        case "gif":
            $image = imagecreatefromgif($targetFile);
            break;
        default:
            return;
            break;
    }
    $height = $imgsize[1] / $imgsize[0] * $width;
    //This maintains proportions
    $src_w = $imgsize[0];
    $src_h = $imgsize[1];
    $picture = imagecreatetruecolor($width, $height);
    imagealphablending($picture, false);
    imagesavealpha($picture, true);
    $bool = imagecopyresampled($picture, $image, 0, 0, 0, 0, $width, $height, $src_w, $src_h);
    if ($bool) {
        $thumbnailFile = $thumbsPath . "thumbnail." . $name;
        switch (lowercase(substr($targetFile, -3))) {
            case "jpg":
                $bool2 = imagejpeg($picture, $thumbnailFile, 85);
                break;
            case "png":
                imagepng($picture, $thumbnailFile);
                break;
            case "gif":
                imagegif($picture, $thumbnailFile);
                break;
        }
    }
    imagedestroy($picture);
    imagedestroy($image);
    return true;
}
     copy($temp, $init);
 }
 # create default components.xml page
 $init = GSDATAOTHERPATH . 'components.xml';
 $temp = GSADMININCPATH . 'tmp/tmp-components.xml';
 if (!file_exists($init)) {
     copy($temp, $init);
 }
 # create default 404.xml page
 $init = GSDATAOTHERPATH . '404.xml';
 $temp = GSADMININCPATH . 'tmp/tmp-404.xml';
 if (!file_exists($init)) {
     copy($temp, $init);
 }
 # create root .htaccess file
 if (!function_exists('apache_get_modules') or in_arrayi('mod_rewrite', apache_get_modules())) {
     $init = GSROOTPATH . '.htaccess';
     $temp_data = file_get_contents(GSROOTPATH . 'temp.htaccess');
     $temp_data = str_replace('**REPLACE**', tsl($path_parts), $temp_data);
     $fp = fopen($init, 'w');
     fwrite($fp, $temp_data);
     fclose($fp);
     if (!file_exists($init)) {
         $kill .= sprintf(i18n_r('ROOT_HTACCESS_ERROR'), 'temp.htaccess', '**REPLACE**', tsl($path_parts)) . '<br />';
     } else {
         unlink(GSROOTPATH . 'temp.htaccess');
     }
 }
 # create gsconfig.php if it doesn't exist yet.
 $init = GSROOTPATH . 'gsconfig.php';
 $temp = GSROOTPATH . 'temp.gsconfig.php';
Beispiel #30
0
}
?>
		<input id="actpass"   name="actpass"   type="checkbox" value="Pass"   <?php 
if (in_arrayi('Pass', $Include_Act)) {
    echo "checked=\"checked\"";
}
?>
 /> Pass
		<input id="actblock"  name="actblock"  type="checkbox" value="Block"  <?php 
if (in_arrayi('Block', $Include_Act)) {
    echo "checked=\"checked\"";
}
?>
 /> Block
		<input id="actreject" name="actreject" type="checkbox" value="Reject" <?php 
if (in_arrayi('Reject', $Include_Act)) {
    echo "checked=\"checked\"";
}
?>
 /> Reject
		<br />
		Interfaces:
		<select id="filterlogentriesinterfaces" name="filterlogentriesinterfaces" class="formselect">
			<option value="All">ALL</option>
<?php 
$interfaces = get_configured_interface_with_descr();
foreach ($interfaces as $iface => $ifacename) {
    ?>
			<option value="<?php 
    echo $iface;
    ?>