function process()
 {
     $cst = array('SU_LOGIN', 'SU_PASSWORD', 'SU_EMAIL', 'PHPMV_URL', 'SEND_MAIL', 'MONDAY_FIRST', 'INTERFACE_DEFAULT_LANG');
     foreach ($cst as $name) {
         if (defined($name)) {
             $values[$name] = constant($name);
         } elseif ($name == 'PHPMV_URL') {
             $values[$name] = Request::getCurrentCompletePath();
         } else {
             $values[$name] = '';
         }
     }
     $passwordMd5OrNot = !empty($values['SU_PASSWORD']) ? md5($values['SU_PASSWORD']) : '';
     $formElements = array(array('text', 'form_login', $GLOBALS['lang']['install_loginadmin'], 'value=' . $values['SU_LOGIN']), array('password', 'form_password', $GLOBALS['lang']['install_mdpadmin'], 'value=' . $passwordMd5OrNot), array('password', 'form_password2', $GLOBALS['lang']['admin_type_again'], 'value=' . $passwordMd5OrNot), array('text', 'form_email', $GLOBALS['lang']['admin_admin_mail'], 'value=' . $values['SU_EMAIL']), array('radio', 'form_send_mail', $GLOBALS['lang']['install_send_mail'], $GLOBALS['lang']['install_oui'], 'yes'), array('radio', 'form_send_mail', null, $GLOBALS['lang']['install_non'], 'no'), array('radio', 'form_monday_first', $GLOBALS['lang']['admin_general_config_firstday'], $GLOBALS['lang']['jsemaine']['Mon'], 'yes'), array('radio', 'form_monday_first', null, $GLOBALS['lang']['jsemaine']['Sun'], 'no'), array('text', 'form_phpmvurl', $GLOBALS['lang']['admin_phpmv_path'], 'size=40 value=' . $values['PHPMV_URL']));
     $lang =& Lang::getInstance();
     $allLangs = $lang->getArrayLangs();
     unset($allLangs['other']);
     $formElements[] = array('select', 'form_interface_default_lang', $GLOBALS['lang']['admin_default_language'], $allLangs);
     $this->addElements($formElements, 'General - phpMyVisites');
     $this->setSelected('form_interface_default_lang', $lang->getFileName());
     $this->setChecked('form_send_mail', defined('SEND_MAIL') ? SEND_MAIL : 'yes');
     $this->setChecked('form_monday_first', defined('MONDAY_FIRST') ? MONDAY_FIRST : 'yes');
     $formRules = array(array('form_email', $GLOBALS['lang']['admin_valid_email'], 'email', '', 'server'), array('form_email', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_admin_mail']), 'required'), array('form_login', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['install_loginadmin']), 'required'), array('form_password', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['install_mdpadmin']), 'required'), array('form_password', $GLOBALS['lang']['admin_valid_pass'], 'complexPassword'), array('form_password', $GLOBALS['lang']['admin_match_pass'], 'compareField', 'form_password2'), array('form_phpmvurl', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_phpmv_path']), 'required'));
     $this->addRules($formRules);
     return parent::process('install_general_setup');
 }
 public function Send($users, $data = false, $templatetype = false, $subject = false, $message = false)
 {
     $nt = NotifyTemplate::getInstance();
     //$ntdata = $nt->FetchData($templateid);
     $us = UserSettings::getInstance();
     $setting = Settings::getInstance();
     $nm = NotificationModule::getInstance();
     $user = User::getInstance();
     $lang = Lang::getInstance();
     for ($i = 0; $i < count($users); $i++) {
         $usersettings = $us->Get($users[$i]['id']);
         if (@$usersettings[$templatetype] != "0") {
             if (is_numeric($usersettings['language'])) {
                 $langdata = $lang->FetchData($usersettings['language']);
                 $langcode = $langdata['code'];
             } else {
                 $langcode = $setting->Get('system.lang.default');
             }
             if (strlen($langcode) != 2) {
                 throw new Exception("Lang code not found or in wrong format");
             }
             if (is_array($data) && $templatetype != '' && $templatetype != false) {
                 if (!is_numeric($templateid = $nt->GetID($templatetype, 'type', "`langcode` = '" . $langcode . "'")) && !is_numeric($templateid = $nt->GetID($templatetype, 'type', "`langcode` = 'en'"))) {
                     throw new Exception("Notify Template not found with type " . $templatetype . " and language " . $langcode);
                 }
                 $ntdata = $nt->FetchData($templateid);
                 if (!is_array($ntdata)) {
                     continue;
                 }
                 $message = $this->prepare_template($ntdata['text'], $data);
             } elseif (is_string($subject) && is_string($message)) {
                 $ntdata['subject'] = $subject;
             } else {
                 throw new Exception("Wrong parameters specified");
             }
             if (is_numeric($usersettings['notifymodule']) && is_string($usersettings['notifyaddress'])) {
                 $moduleid = $usersettings['notifymodule'];
                 $address = $usersettings['notifyaddress'];
             } else {
                 $userdata = $user->FetchData($users[$i]['id']);
                 $moduleid = $setting->Get('system.notifymodule.default');
                 $address = $userdata['email'];
             }
             if (strlen($address) < 2 || !is_numeric($moduleid)) {
                 continue;
             }
             if ($nm->Send($moduleid, $address, $ntdata['subject'], $message)) {
                 $status = 'Done';
             } else {
                 $status = 'Fail';
             }
             $this->Create(array('userid' => $users[$i]['id'], 'moduleid' => $moduleid, 'subject' => $ntdata['subject'], 'text' => $message, 'address' => $address, 'status' => $status));
         } else {
             return true;
         }
     }
     return true;
 }
示例#3
0
    public function Form($operate_array, $data_array)
    {
        $lang = Lang::getInstance();
        if (!preg_match('/(en|ru)/i', $userlang = $lang->GetLang4User($data_array['invoice']['accountid']))) {
            $userlang = 'ru';
        }
        return '         
		<form action="https://sprypay.ru/sppi/" method="post">
		<input type="hidden" name="spShopId" value="' . $operate_array['shopid'] . '">
		<input type="hidden" name="spShopPaymentId" value="' . $data_array['invoice']['id'] . '">
		<input type="hidden" name="spAmount" value="' . $data_array['invoice']['amount'] . '">
		<input type="hidden" name="spCurrency" value="' . $data_array['currency'] . '">
		<input type="hidden" name="spPurpose" value="' . $data_array['invoice']['comment'] . '">
		<input type="hidden" name="spUserEmail" value="' . $data_array['userdata']['email'] . '">
		<input type="hidden" name="lang" value="' . $userlang . '">
		';
    }
示例#4
0
 public static function getErrorMessage($code)
 {
     return Lang::getInstance()->get(self::$errorCodes[$code]);
 }
示例#5
0
 public static function UserPersonalSettings()
 {
     $xtpl = self::$xtpl;
     $nm = NotificationModule::getInstance();
     $lang = Lang::getInstance();
     $setting = Settings::getInstance();
     $usrstg = UserSettings::getInstance();
     $curr = Currency::getInstance();
     $xtpl->assign('SETCURR', 'current');
     $xtpl->assign('SYSTEMCURRSETT', 'current');
     $nms = $nm->GetButch();
     $langs = $lang->GetButch();
     $currs = $curr->GetButch();
     if ($usersettings = $usrstg->Get(self::$userid)) {
         $xtpl->assign('NOTIFYADDRESS', $usersettings['notifyaddress']);
         if ($usersettings['usernewinvoice'] == "1") {
             $xtpl->assign('NEWINVSEL', 'checked="checked"');
         }
         if ($usersettings['userneworder'] == "1") {
             $xtpl->assign('NEWORDSEL', 'checked="checked"');
         }
         if ($usersettings['usernewticket'] == "1") {
             $xtpl->assign('NEWTCSEL', 'checked="checked"');
         }
         if ($usersettings['usernewticketreply'] == "1") {
             $xtpl->assign('NEWTRSEL', 'checked="checked"');
         }
     }
     for ($i = 0; $i < count($nms); $i++) {
         if ($nms[$i]['id'] == @$usersettings['notifymodule'] || $nms[$i]['id'] == $setting->Get('system.notifymodule.default')) {
             $xtpl->assign('DEFAULT', 'selected="selected"');
         } else {
             $xtpl->assign('DEFAULT', '');
         }
         $xtpl->assign('NM', $nms[$i]);
         $xtpl->parse('main.personalsettings.ntlist');
     }
     for ($i = 0; $i < count($langs); $i++) {
         if ($langs[$i]['code'] == @$usersettings['language'] || $langs[$i]['code'] == $setting->Get('system.lang.default')) {
             $xtpl->assign('DEFAULT', 'selected="selected"');
         } else {
             $xtpl->assign('DEFAULT', '');
         }
         //var_dump($langs[$i]);
         $xtpl->assign('LNG', $langs[$i]);
         $xtpl->parse('main.personalsettings.langlist');
     }
     for ($i = 0; $i < count($currs); $i++) {
         if ($currs[$i]['name'] == @$usersettings['currency'] || $currs[$i]['name'] == $setting->Get('system.currency')) {
             $xtpl->assign('DEFAULT', 'selected="selected"');
         } else {
             $xtpl->assign('DEFAULT', '');
         }
         $xtpl->assign('CURR', $currs[$i]);
         $xtpl->parse('main.personalsettings.currlist');
     }
     $xtpl->parse('main.personalsettings');
     $xtpl->parse('main');
     $xtpl->out('main');
 }
    // else, display pixel
    $img = INCLUDE_PATH . "/images/logos/pixel.gif";
    header("Content-type: image/gif");
    readfile($img);
    exit;
}
// hack for not to show tables (because getCurrentCompleteUrl bugs
// with url containing another url in one parameter)
$GLOBALS['currentModuleIsLogModule'] = true;
$c =& PmvConfig::getInstance();
$db =& Db::getInstance();
$db->connect();
// when no get specified, display a marketing page :)
if (sizeof($_GET) === 0) {
    require_once INCLUDE_PATH . "/core/include/Lang.class.php";
    $l =& Lang::getInstance();
    displayPageWhenEmptyGet();
    exit;
}
if (DEBUG) {
    require_once INCLUDE_PATH . "/core/include/functions.php";
}
if (DEBUG) {
    ob_start();
}
// - imprimer doc mysql "optimisation"
/*
 * Get page & visitor information
 */
$idSite = getRequestVar('id', null, 'numeric');
$GLOBALS['cookie'] = new Cookie(COOKIE_PMVLOG_NAME . $idSite);
 function loadLang()
 {
     $this->lang =& Lang::getInstance();
 }
    function showAll()
    {
        $this->tpl->setMainTemplate("structure_mail.tpl");
        $this->request->setModuleName('view_visits_rss');
        $allSiteArchive = DataModel::getSites();
        /**
         * Cache Lite
         */
        $options = array('cacheDir' => DIR_CACHE_MAIL, 'lifeTime' => CACHE_MAIL_LIFETIME);
        $Cache_Lite = new Cache_Lite($options);
        $lang =& Lang::getInstance();
        // case update to 2.2RC1 without executing global info
        if (!defined('INTERFACE_DEFAULT_LANG')) {
            define('INTERFACE_DEFAULT_LANG', 'en-utf-8.php');
        }
        $lang->setNewLang(INTERFACE_DEFAULT_LANG);
        /**
         * Compute mails
         */
        $o_config =& PmvConfig::getInstance();
        foreach ($allSiteArchive as $infoSite) {
            /**
             * php Mailer
             */
            $mail = new MyMailer();
            $mail->IsHTML(true);
            $imgUrl = INCLUDE_PATH . "/themes/default/images/phpmv.png";
            $mail->AddEmbeddedImage($imgUrl, "my-attach", $GLOBALS['lang']['logo_description'], "base64", "image/png");
            $uniqCacheId = md5(serialize($infoSite) . date("Y-m-d")) . '.mail';
            // Test if thereis a valide cache for this id
            if (true) {
                $o_mod = new ViewVisitsRss($infoSite);
                $this->request->date = getDateFromTimestamp(time() - 86400);
                $o_mod->init($this->request);
                $dateLiteral = $o_mod->data->archive->getLiteralDate();
                $body = '<html xml:lang="fr" >
						<head>
							<meta http-equiv="content-type" content="text/html; charset=utf-8" />
						</head>
						
						<body>
						';
                $body .= $o_mod->showAll(true, true);
                $body .= '</body></html>';
                $textBody = strip_tags($body);
                $subject = vsprintf($GLOBALS['lang']['rss_titre'], array($infoSite->getName(), $dateLiteral));
                print "<br>Subject : {$subject}<hr>";
                print "<br>Content : {$body}<hr>";
                //$Cache_Lite->save($body);
            }
            $mail->Subject = $subject;
            $mail->Body = $body;
            $mail->AltBody = $textBody;
            $mail->CharSet = $GLOBALS['lang']['charset'];
            $user = new UserConfigDb();
            $groups = $user->getGroups();
            $users = array_merge(array(0 => array('email' => SU_EMAIL, 'alias' => 'phpMyVisites Administrator', 'send_mail' => SEND_MAIL == "yes" ? 1 : 0)), $user->getUserByGroup(1, $infoSite->getId()), $user->getUserByGroup(2, $infoSite->getId()));
            // we send all emails once
            $emailsToSend_infos = array('object' => $mail, 'to' => array());
            // add recipients for the mail
            foreach ($users as $userInfo) {
                //print_r($userInfo);
                if (!empty($userInfo['email']) && $userInfo['send_mail'] == 1) {
                    $emailsToSend_infos['to'][] = array($userInfo['email'], $userInfo['alias']);
                }
            }
            $emailsToSend[] = $emailsToSend_infos;
        }
        // send all emails
        foreach ($emailsToSend as $currMail) {
            $mail =& $currMail['object'];
            foreach ($currMail['to'] as $recipient) {
                $mail->AddAddress($recipient[0], $recipient[1]);
                if (!@$mail->Send()) {
                    echo "<u><b>There was an error sending the message to " . $userInfo['email'] . "</u></b><br>";
                } else {
                    echo "<u><b>Message was sent successfully to " . $userInfo['email'] . "</u></b><br>";
                }
                $mail->ClearAddresses();
            }
        }
    }
示例#9
0
文件: _setup.php 项目: GGF/baza4
// при правильном использовании namespace достаточно только (PSR-0  https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md)
spl_autoload_register();
// а так придестя зарегить функцию вслед за дефолтной
spl_autoload_register('Autoloader::loadPackages');
// сам класс 'Autoloader' описан по PSR-0
// очень внимательно файлы будут искаться в МАЛЕНЬКИМИ буквами autoloader.php - Это известный БАГ и скоро может быть пофиксен
/*
 * Строки ниже  есть в файле autoload
 * НО с использованием SPL приишлось вставить сюда потому, что
 * auttoload включался  каждый раз, а теперь используется include_once
 */
if (!$_SERVER["debug"]["noCache"]["php"]) {
    if (!empty($_SESSION["cache"]) && is_array($_SESSION["cache"])) {
        require_once realpath($_SERVER['DOCUMENT_ROOT']) . cache::buildScript($_SESSION["cache"], 'php');
    }
}
/*
 * пожалуй уберу строчку из файла autoload и поставлю включение сюда
 */
//include_once __DIR__ . '/_engine/autoload.php'; // инклудим автозагрузку модулей
ob_get_clean();
/*
 * Делать хоть один инстанс нужно для включения скриптов в заголовки
 */
Lang::getInstance()->setLang('ru');
// перехватим ошибки
if ($_SERVER[debug][report]) {
    console::getInstance();
    //->out(print_r($_REQUEST, true));
    profiler::add('Autoexec', 'Выполнение начальных установок');
}
示例#10
0
         Page::$messages[] = array('type' => 'attention', 'message' => 'Order ID is not set');
     } else {
         $order = Order::getInstance();
         $order->Delete($_REQUEST['orderid']);
         Page::ManageOrders();
     }
     break;
 case 'updatedep':
     $dep = Department::getInstance();
     $dep->id = $_POST['depid'];
     $dep->Update('name', $_POST['depname']);
     $dep->Update('type', $_POST['type']);
     Page::ManageDepartments();
     break;
 case 'updatelangs':
     $lang = Lang::getInstance();
     $lang->UpdateLangs();
     Page::GeneralSettings();
     break;
 case 'updatelang':
     $setting = Settings::getInstance();
     $setting->Update('system.lang.default', $_POST['langcode']);
     Page::GeneralSettings();
     break;
 case 'updatecurr':
     $curr = Currency::getInstance();
     if (!is_numeric($_POST['curid'])) {
         throw Exception("Currency ID must be numeric");
     }
     $curr->Update('name', $_POST['name'], $_POST['curid']);
     $curr->Update('symbol', $_POST['symbol'], $_POST['curid']);
 function addPluginLangFile($p_pluginsPathLang, $p_defaultFileName = "en-utf-8.php")
 {
     $langInstance =& Lang::getInstance();
     if ($p_pluginsPathLang != "" && substr($p_pluginsPathLang, -1) != "/") {
         $p_pluginsPathLang .= "/";
     }
     // Set default laguage
     $lang = array();
     if (is_file(PLUGINS_PATH . $p_pluginsPathLang . $p_defaultFileName)) {
         require PLUGINS_PATH . $p_pluginsPathLang . $p_defaultFileName;
         $GLOBALS['lang'] = array_merge($GLOBALS['lang'], $lang);
     }
     // Try to set the good lang file
     $lang = array();
     if (is_file(PLUGINS_PATH . $p_pluginsPathLang . $langInstance->getFileName())) {
         require PLUGINS_PATH . $p_pluginsPathLang . $langInstance->getFileName();
         $GLOBALS['lang'] = array_merge($GLOBALS['lang'], $lang);
     }
 }
function displayPageWhenEmptyGet()
{
    // random lang
    $lang =& Lang::getInstance();
    $lang->setRandomLang();
    print "<html>\n\t\t\t<head>\n\t\t\t\t<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n\t\t\t\t<meta name=\"description\" content=\"" . $GLOBALS['lang']['head_description'] . "\" />\n\t\t\t\t<meta name=\"keywords\" content=\"" . $GLOBALS['lang']['head_keywords'] . "\" />\n\t\t\t\t<meta name=\"copyright\" content=\"phpMyVisites\" />\n\t\t\t\t<title>" . $GLOBALS['lang']['head_titre'] . " = Websites statistics for " . Request::getHostUrl() . "</title>\n\t\t\t</head>\n\t\t\t<body>";
    print "\n<h1>" . $GLOBALS['lang']['logo_description'] . "</h1>";
    print "\n\t\t\t<p>Whatever you need, free counter, web counter ? Try <a href='http://www.phpmyvisites.us/'>Web site statistics</a> ! It's FREE :-)</p>\n\t\t\t<p>" . $GLOBALS['lang']['contacts_merci3'] . "</p>\n\t\t\t<p>" . $GLOBALS['lang']['contacts_trad1'] . "</p>\n\t\t\t<p>" . $GLOBALS['lang']['contacts_merci2'] . "</p>\n\t\t\t<p>" . str_replace("Matthieu Aubry", "<a href='http://giik.net/'>Matthieu</a> Aubry (<a href='http://giik.net/blog/'>blog</a>)", $GLOBALS['lang']['contacts_auteur']) . "</p>\n\t\t\t\n\t\t\t\n\t\t\t<p>Statistics consist of seven parts : \n\t\t\t" . $GLOBALS['lang']['menu_visites'] . ", \n\t\t\t" . $GLOBALS['lang']['menu_pagesvues'] . ", \n\t\t\t" . $GLOBALS['lang']['menu_suivi'] . ",\n\t\t\t" . $GLOBALS['lang']['menu_provenance'] . ",\n\t\t\t" . $GLOBALS['lang']['menu_configurations'] . ", \n\t\t\t" . $GLOBALS['lang']['menu_affluents'] . ", \n\t\t\t" . $GLOBALS['lang']['menu_bilansites'] . ", \n\t\t\t available for the period \n\t\t\t" . $GLOBALS['lang']['menu_jour'] . ", \n\t\t\t" . $GLOBALS['lang']['menu_semaine'] . ",  \n\t\t\t" . $GLOBALS['lang']['menu_mois'] . ", \n\t\t\t" . $GLOBALS['lang']['menu_annee'] . "\n\t\t\t</p>\n\t\t\t\n\t\t\t<p>phpMyVisites can for example gives these informations : \n\t\t\t" . $GLOBALS['lang']['visites_statistiques'] . ", \n\t\t\t" . $GLOBALS['lang']['visites_visites'] . ", \n\t\t\t" . $GLOBALS['lang']['visites_uniques'] . ",  \n\t\t\t" . $GLOBALS['lang']['visites_pagesvues'] . ",  \n\t\t\t" . $GLOBALS['lang']['visites_pagesvisiteurs'] . ",  \n\t\t\t" . $GLOBALS['lang']['visites_pagesvisites'] . ", \n\t\t\t" . $GLOBALS['lang']['visites_pagesvisitessign'] . ", \n\t\t\t" . $GLOBALS['lang']['visites_tempsmoyen'] . ", \n\t\t\t" . $GLOBALS['lang']['visites_tempsmoyenpv'] . ", \n\t\t\t" . $GLOBALS['lang']['visites_tauxvisite'] . ",\n\t\t\t" . $GLOBALS['lang']['visites_average_visits_per_day'] . "\n\t\t\t</p>\n\t\t\t\n\t\t\t\n\t\t\t<p>phpMyVisites has a powerful administration tool. For example you can :</p>\n\t\t\t<ul>\n\t\t\t<li> " . $GLOBALS['lang']['admin_cookienavigateur'] . "</li>\n\t\t\t<li>" . $GLOBALS['lang']['admin_ip_ranges'] . "</li>\n\t\t\t<li>" . $GLOBALS['lang']['admin_get_a1'] . " / " . $GLOBALS['lang']['admin_get_a2'] . " / " . $GLOBALS['lang']['admin_get_a3'] . " / " . $GLOBALS['lang']['admin_get_a4'] . "</li>\n\t\t\t<li>" . $GLOBALS['lang']['admin_nl_add'] . " / " . $GLOBALS['lang']['admin_partner_add'] . " / " . $GLOBALS['lang']['admin_site_add'] . " </li>\n\t\t\t<li>" . $GLOBALS['lang']['admin_send_mail'] . " / " . $GLOBALS['lang']['admin_rss_feed'] . "</li>\n\t\t\t<li>" . $GLOBALS['lang']['admin_server_info'] . "</li>\n\t\t\t</ul>\n\t\t\t";
    print "\n<p>(Text in " . $GLOBALS['lang']['lang_libelle_en'] . " provided by " . $GLOBALS['lang']['auteur_nom'] . ")\n\t\t\t<p>Thanks to " . Request::getHostUrl() . ", they have chosen phpMyVisites for their web analytics</p>";
    print "\n<p>" . $GLOBALS['lang']['lang_libelle_en'] . "</p>\n\t\t\t<p><a href='http://www.phpmyvisites.us/'>" . $GLOBALS['lang']['head_description'] . "</a></p>\n\t\t\t ";
    //displayLang();
    print "\n<h2>Is phpmyvisites THE solution?</h2>";
    print "\n <p>Free software is good for you!</p> <a href='http://www.phpmyvisites.us/'>Web Analytics</a></p>";
    //displayLang();
    print "\n<h2>Statistics demo</h2>\n\t\t\t<p>See statistics (if they are not protected by phpMyVisites administrator) for <a href=\"" . Request::getHostUrl() . "\">" . Request::getHostUrl() . "</a> ; you can also try <a href='http://www.phpmyvisites.us'>Internet Statistics</a></p>";
    //displayLang();
    print "<p>[ Today's date is " . date('r') . " ]</p>\n\t\t\t</body>\n\t\t   </html>";
}