function _default_assignments()
 {
     $sm = vivvo_lite_site::get_instance();
     $um = $sm->get_url_manager();
     $dm = $sm->get_dump_manager();
     $template = $sm->get_template();
     require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Articles.class.php';
     $articles_list = new Articles_list($sm);
     $articles_list->reset_list_query();
     $template->assign('website_articles_pending', strval($articles_list->get_count(array('search_status' => 0))));
     //Check installer
     if (file_exists(dirname(__FILE__) . '/../installer/index.php')) {
         $dm->add_dump('warning', 0, vivvo_lang::get_instance()->get_value('LNG_ADMIN_INSTALLER_WARNING'));
     }
 }
/**
 * Formats date
 *
 * @param   int             $seconds
 * @return  string
 */
function _pretty_date_format($seconds)
{
    $lang = vivvo_lang::get_instance();
    $formats = array(array(60, $lang->get_value('LNG_PRETTY_DATE_FEW_MOMENTS')), array(120, $lang->get_value('LNG_PRETTY_DATE_1_MINUTE')), array(3600, array(60, $lang->get_value('LNG_PRETTY_DATE_MINUTES'))), array(7200, $lang->get_value('LNG_PRETTY_DATE_1_HOUR')), array(86400, array(3600, $lang->get_value('LNG_PRETTY_DATE_HOURS'))));
    for ($i = 0, $len = count($formats); $i < $len; $i++) {
        $format = $formats[$i];
        if ($seconds < $format[0]) {
            if (is_array($format[1])) {
                $formatted = floor($seconds / $format[1][0]) . ' ' . $format[1][1];
                $seconds = $seconds % $format[1][0];
                if ($seconds > 60) {
                    $formatted .= ' ' . _pretty_date_format($seconds);
                }
            } else {
                $formatted = $format[1];
            }
            return $formatted;
        }
    }
    return $lang->get_value('LNG_PRETTY_DATE_VERY_LONG_TIME');
}
Esempio n. 3
0
/**
 * Action handler function
 *
 * @param	&vivvo_lite_site	$sm
 * @param	string				$action
 * @param	string				$command
 * @return	bool
 */
function feed_service($sm, $action, $command)
{
    if ($action != 'feed') {
        return false;
    }
    require_once dirname(__FILE__) . '/feed.service.php';
    $service = new feed_service($sm);
    $um = $sm->get_url_manager();
    $dm = $sm->get_dump_manager();
    $lang = vivvo_lang::get_instance();
    if ($command == 'edit') {
        $feed_id = $um->get_param('PLUGIN_FEED_id');
        $in_feed = $um->get_param_regexp('/^PLUGIN_FEED_/');
        if ($service->edit_feed($feed_id, $in_feed)) {
            $dm->add_dump('info', 0, $lang->get_value('LNG_INFO_PLUGIN_FEED_EDIT_SUCCESS'));
            header('X-Vivvo-Action-Status: 1');
            vivvo_hooks_manager::call('feed_edit_postaction');
            return true;
        }
    } elseif ($command == 'preferences') {
        if (is_array($um->list) and !empty($um->list)) {
            foreach ($um->list as $key => $value) {
                if (preg_match('/^(VIVVO_PLUGIN_FEED_IMPORTER_)/', $key)) {
                    if (!($response = $service->preferences_feed($key, $um->list[$key]))) {
                        break;
                    }
                }
            }
        }
        if (!empty($response)) {
            $dm->add_dump('info', 0, $lang->get_value('LNG_INFO_PLUGIN_FEED_PREFERENCES_SUCCESS'));
            header('X-Vivvo-Action-Status: 1');
            vivvo_hooks_manager::call('feed_preferences_postaction');
            return true;
        }
    }
    header('X-Vivvo-Action-Status: 0');
    header('X-Vivvo-Action-Error: ' . json_encode($service->get_error_info()));
    return false;
}
Esempio n. 4
0
 /**
  * Set error
  *
  * @return dump_message
  */
 function &set_error_code($error = false, $aditional_info = '')
 {
     if (!$error) {
         $error = 13;
     }
     if (!$this->_dump_handler) {
         $this->set_dump_handler();
     }
     $lang = vivvo_lang::get_instance();
     $this->dump_object =& $this->_dump_handler->add_dump('error', $error, $lang->get_value('LNG_ERROR_' . $error));
     $this->dump_object->additional_info = $lang->get_value('LNG_CONF_' . $this->variable_name) . $this->variable_name;
     return $this->dump_object;
 }
Esempio n. 5
0
/**
 * Step 6, sets administration parameters in database and creates welcome email.
 * At this step installation is finished and user can choose further action.
 *
 * @param template $template
 * @param dump_manager $dm
 * @param vivvo_lang $lang
 * @return void
 */
function step6(&$template, &$dm, &$lang)
{
    require_once dirname(__FILE__) . '/../conf.php';
    if ($db = @mysql_connect(VIVVO_DB_HOST, VIVVO_DB_USER, VIVVO_DB_PASSWORD)) {
        if (mysql_select_db(VIVVO_DB_DATABASE, $db)) {
            @mysql_query('SET NAMES utf8', $db);
            $web_site_title = $_REQUEST['web_site_title'];
            $administrator_email = $_REQUEST['administrator_email'];
            $admin_username = $_REQUEST['admin_username'];
            $admin_password = $_REQUEST['admin_password'];
            $admin_password_retype = $_REQUEST['admin_password_retype'];
            if (!preg_match("/^[-_a-zA-Z0-9]+(\\.[-_a-zA-Z0-9]+)*@[-a-zA-Z0-9]+(\\.[-a-zA-Z0-9]+)*\\.[a-zA-Z]{2,6}\$/", $administrator_email)) {
                $dm->add_dump('info', 0, $lang->get_value('LNG_INSTALLER_WRONG_EMAIL'));
                $template->assign('step', strval(5));
            } elseif ($admin_username == '') {
                $dm->add_dump('info', 0, $lang->get_value('LNG_INSTALLER_WRONG_USERNAME'));
                $template->assign('step', strval(5));
            } elseif (strlen($admin_password) < 6) {
                $dm->add_dump('info', 0, $lang->get_value('LNG_INSTALLER_PASSWORD_MINIMUM_6_CHAR'));
                $template->assign('step', strval(5));
            } elseif ($admin_password != $admin_password_retype) {
                $dm->add_dump('info', 0, $lang->get_value('LNG_INSTALLER_PASSWORD_AND_RETYPE_PASSWORD_MUST_BE_SAME'));
                $template->assign('step', strval(5));
            } else {
                define('VIVVO_WEBSITE_TITLE', $web_site_title);
                define('VIVVO_ADMINISTRATORS_EMAIL', $administrator_email);
                define('VIVVO_EMAIL_SEND_FROM', $administrator_email);
                define('VIVVO_ADMIN_USERNAME', $admin_username);
                define('VIVVO_ADMIN_PASSWORD', $admin_password);
                require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/framework/sqlrunner.class.php';
                // load sql runner
                $sqlRunner = new SQLRunner(array('db' => $db, 'stop_on_error' => true));
                // Execute scheme.sql
                if ($sqlRunner->load(dirname(__FILE__) . '/db/post-install.sql') > 0) {
                    try {
                        $scheme = $sqlRunner->run();
                    } catch (SQLRunnerException $e) {
                        $dm->add_dump('error', 0, $lang->get_value('LNG_INSTALLER_ERROR_EXECUTING_SQL'), $e->getMessage());
                        $template->assign('step', strval(4));
                        return;
                    }
                } else {
                    $dm->add_dump('error', 0, $lang->get_value('LNG_INSTALLER_INVALID_SQL_FILE') . 'post-install.sql');
                    $template->assign('step', strval(4));
                    return;
                }
                $template->assign('step', strval(6));
                // Send information email
                $header = "From: Vivvo CMS Installation Wizard <" . $administrator_email . ">\r\n";
                $header .= "MIME-Version: 1.0\r\n";
                $header .= "Content-type: text/html; charset=utf-8\r\n";
                $subject = "=?UTF-8?B?" . base64_encode('Installation Complete') . "?=";
                $email_template = new template(null, $template);
                $email_template->set_template_file(VIVVO_FS_ROOT . 'installer/templates/email.xml');
                $body = $email_template->get_output();
                @mail($administrator_email, $subject, $body, $header);
            }
        } else {
            $dm->add_dump('info', 0, $lang->get_value('LNG_INSTALLER_CANT_SELECT_DATABASE'));
            $template->assign('step', strval(5));
        }
    } else {
        $dm->add_dump('info', 0, $lang->get_value('LNG_INSTALLER_CANT_CONNECT_TO_DATABASE'));
        $template->assign('step', strval(5));
    }
}
Esempio n. 6
0
 /**
  * Report 404 error via e-mail
  *
  * @param	integer		$comment_id
  * @return	boolean		true on succes, or false on fail
  */
 function report_404($url, $referrer = '')
 {
     if (!vivvo_hooks_manager::call('user_report404', array(&$url))) {
         return vivvo_hooks_manager::get_status();
     }
     require_once dirname(__FILE__) . '/../../../lib/vivvo/framework/PEAR/Mail.php';
     $url = htmlspecialchars($url);
     $referrer = htmlspecialchars($referrer);
     if (VIVVO_EMAIL_ENABLE == 1) {
         $lang = vivvo_lang::get_instance();
         $body .= $lang->get_value('LNG_REPORT_404_BODY') . "\n";
         $body .= 'URL : ' . $url . "\n";
         $body .= 'Referrer : ' . $referrer . "\n\n";
         $to = VIVVO_ADMINISTRATORS_EMAIL;
         $headers['From'] = VIVVO_ADMINISTRATORS_EMAIL;
         $headers['To'] = VIVVO_ADMINISTRATORS_EMAIL;
         $subject = str_replace('<WEBSITE_TITLE>', VIVVO_WEBSITE_TITLE, $lang->get_value('LNG_REPORT_404_MAIL_SUBJECT'));
         $headers['Subject'] = "=?UTF-8?B?" . base64_encode($subject) . "?=";
         $headers['Content-Type'] = "text/plain; charset=UTF-8;";
         if (VIVVO_EMAIL_SMTP_PHP == 1) {
             $mail_object = new Mail();
             $mail_object->send($to, $headers, $body);
         } else {
             $mail_options['driver'] = 'smtp';
             $mail_options['host'] = VIVVO_EMAIL_SMTP_HOST;
             $mail_options['port'] = VIVVO_EMAIL_SMTP_PORT;
             $mail_options['localhost'] = 'localhost';
             if (VIVVO_EMAIL_SMTP_PASSWORD != '' && VIVVO_EMAIL_SMTP_USERNAME != '') {
                 $mail_options['auth'] = true;
                 $mail_options['username'] = VIVVO_EMAIL_SMTP_USERNAME;
                 $mail_options['password'] = VIVVO_EMAIL_SMTP_PASSWORD;
             } else {
                 $mail_options['auth'] = false;
                 $mail_options['username'] = '';
                 $mail_options['password'] = '';
             }
             $mail_object =& Mail::factory('smtp', $mail_options);
             $mail_object->send($to, $headers, $body);
         }
         return true;
     }
 }
Esempio n. 7
0
 /**
  * Load frontend lang
  *
  * @deprecated deprecated since version 4.1
  */
 function load_lang()
 {
     $pm = vivvo_lite_site::get_instance()->get_plugin_manager();
     $lang = vivvo_lang::get_instance();
     $lang->load_lang(VIVVO_ADMIN_LANG, $pm->plugins[$this->plugin_name]['root_dir'] . 'lang/');
 }
Esempio n. 8
0
 function edit_preferences($variable_name, $variable_value)
 {
     if (!$this->check_token()) {
         return false;
     }
     if (!vivvo_hooks_manager::call('vivvoCore_preferences', array(&$variable_name, &$variable_value))) {
         return vivvo_hooks_manager::get_status();
     }
     $sm = vivvo_lite_site::get_instance();
     if ($this->_user && $this->_user->is_admin()) {
         require_once VIVVO_FS_FRAMEWORK . 'vivvo_preference.php';
         $preferences_list = new preferences_list();
         $preferences = $preferences_list->get_preference_by_variable_name($variable_name);
         if ($preferences != false) {
             $variable_value = htmlspecialchars($variable_value, ENT_QUOTES, 'UTF-8');
             if ($variable_name == 'VIVVO_GENERAL_TIME_ZONE_FORMAT') {
                 $timezone_abbreviations = DateTimeZone::listIdentifiers();
                 if (in_array($variable_value, $timezone_abbreviations)) {
                     $preferences->set_variable_value($variable_value);
                     $this->_post_master->set_data_object($preferences);
                 } else {
                     $this->set_error_code(5122);
                     return false;
                 }
             } elseif ($variable_name == 'VIVVO_ALLOWED_IP_ADDRESSES') {
                 // normalize passed string (convert to comma-separated IPs)
                 $variable_value = str_replace(array("\r\n", "\n"), ',', $variable_value);
                 $variable_value = preg_replace('/\\s+/', '', $variable_value);
                 $variable_value = trim(preg_replace('/,+/', ',', $variable_value), ',');
                 if (!empty($variable_value)) {
                     $addresses = explode(',', $variable_value);
                     // check valid IP format (with wildcards)
                     foreach ($addresses as $addr) {
                         $parts = explode('.', $addr);
                         if (count($parts) == 4) {
                             foreach ($parts as $part) {
                                 if ($part == '*' or is_numeric($part) and ($part = (int) $part) > -1 and $part < 256) {
                                     continue;
                                 }
                                 $this->set_error_code(5120);
                                 return false;
                             }
                         } else {
                             $this->set_error_code(5120);
                             return false;
                         }
                     }
                     // prevent user blocking itself
                     $listed = false;
                     foreach ($addresses as $addr) {
                         if (fnmatch($addr, $this->_user->ip)) {
                             $listed = true;
                             break;
                         }
                     }
                     if ($listed == false) {
                         $this->set_error_code(5119);
                         return false;
                     }
                     unset($addresses, $addr, $parts, $part);
                 }
                 $preferences->set_variable_value($variable_value);
                 $this->_post_master->set_data_object($preferences);
             } elseif ($variable_name == 'VIVVO_EMAIL_SMTP_PHP' && $variable_value == 0) {
                 $um = $sm->get_url_manager();
                 $lang = vivvo_lang::get_instance();
                 $missing = array();
                 $host = $um->get_param('VIVVO_EMAIL_SMTP_HOST');
                 $username = $um->get_param('VIVVO_EMAIL_SMTP_USERNAME');
                 $password = $um->get_param('VIVVO_EMAIL_SMTP_PASSWORD');
                 empty($host) and $missing[] = $lang->get_value('LNG_CONF_VIVVO_EMAIL_SMTP_HOST');
                 empty($username) and $missing[] = $lang->get_value('LNG_CONF_VIVVO_EMAIL_SMTP_USERNAME');
                 empty($password) and $missing[] = $lang->get_value('LNG_CONF_VIVVO_EMAIL_SMTP_PASSWORD');
                 if (!empty($missing)) {
                     $this->set_error_code(5121, implode(', ', $missing));
                     $template = $sm->get_template();
                     $template->assign('VIVVO_EMAIL_SMTP_HOST', $host);
                     $template->assign('VIVVO_EMAIL_SMTP_USERNAME', $username);
                     $template->assign('VIVVO_EMAIL_SMTP_PASSWORD', $password);
                     return false;
                 }
                 $preferences->set_variable_value($variable_value);
                 $this->_post_master->set_data_object($preferences);
             } elseif ($variable_name == 'VIVVO_GA_ENABLED' and $variable_value) {
                 $um = $sm->get_url_manager();
                 $lang = vivvo_lang::get_instance();
                 $missing = array();
                 $email = $um->get_param('VIVVO_GA_EMAIL');
                 $password = $um->get_param('VIVVO_GA_PASSWORD');
                 $code = $um->get_param('VIVVO_GA_CODE');
                 empty($email) and $missing[] = $lang->get_value('LNG_CONF_VIVVO_GA_EMAIL');
                 empty($password) and $missing[] = $lang->get_value('LNG_CONF_VIVVO_GA_PASSWORD');
                 empty($code) and $missing[] = $lang->get_value('LNG_CONF_VIVVO_GA_CODE');
                 if (!empty($missing)) {
                     $this->set_error_code(5123, implode(', ', $missing));
                     // missing google analytics parameter(s)
                     $template = $sm->get_template();
                     $template->assign('VIVVO_GA_EMAIL', $email);
                     $template->assign('VIVVO_GA_PASSWORD', $password);
                     $template->assign('VIVVO_GA_CODE', $code);
                     return false;
                 }
                 $params = array('username' => $email, 'password' => $password, 'no_auth' => true);
                 if (vivvo_ga::get_instance($params)->authorize($email, $password, true) == false) {
                     $this->set_error_code(5124);
                     // google analytics authentication failed.
                     $template = $sm->get_template();
                     $template->assign('VIVVO_GA_EMAIL', $email);
                     $template->assign('VIVVO_GA_PASSWORD', $password);
                     $template->assign('VIVVO_GA_CODE', $code);
                     return false;
                 }
                 $preferences->set_variable_value($variable_value);
                 $this->_post_master->set_data_object($preferences);
             } elseif ($preferences->check_value($variable_value)) {
                 $preferences->set_variable_value($variable_value);
                 $this->_post_master->set_data_object($preferences);
             } else {
                 $preferences->set_error_code();
                 return false;
             }
             if ($this->_post_master->sql_update()) {
                 admin_log($sm->user->get_username(), 'Edited vivvo preferences.');
                 return true;
             } else {
                 $this->set_error_code(5101);
                 return false;
             }
         } else {
             $this->set_error_code(5102, $variable_name);
             return false;
         }
     } else {
         $this->set_error_code(5103);
         return false;
     }
 }
Esempio n. 9
0
 /**
  * Add tag group
  *
  * @param	string	$name
  * @param	string	$url
  * @param	string	$template
  * @param	array	$metadata
  */
 public function add_tag_group($name, $url, $template, $tag_template, $metadata, $return_id_if_exists = false, $new_tags = '')
 {
     if (!vivvo_hooks_manager::call('tag_addGroup', array(&$name, &$url, &$template, &$tag_template, &$metadata, &$return_id_if_exists, &$new_tags))) {
         return vivvo_hooks_manager::get_status();
     }
     $sm = vivvo_lite_site::get_instance();
     $user = $sm->user;
     if ($user && $user->can('MANAGE_TAGS')) {
         $tag_group_list = new TagsGroups_list();
         $tag_group = new TagsGroups();
         if (!$tag_group->set_name($name = htmlspecialchars($name, ENT_QUOTES, 'UTF-8'))) {
             $this->set_error_code(12, vivvo_lang::get_instance()->get_value('LNG_DB_tags_groups_name'));
             return false;
         }
         if ($existing_group = $tag_group_list->get_group_by_name($name)) {
             if (!$return_id_if_exists) {
                 $this->set_error_code(2417);
                 return false;
             }
             return $existing_group->get_id();
         }
         $um = $sm->get_url_manager();
         if (empty($url)) {
             $url = make_sefriendly($name);
         } else {
             $url = make_sefriendly($url);
         }
         $um->set_param('TAG_GROUP_url', $url);
         $sefriendly = secure_sql($url);
         $sql = 'SELECT id FROM ' . VIVVO_DB_PREFIX . "categories WHERE sefriendly = '{$sefriendly}' LIMIT 1 UNION\n\t\t\t\t\t\tSELECT id FROM " . VIVVO_DB_PREFIX . "tags_groups WHERE url = '{$sefriendly}' LIMIT 1";
         if (($res = $sm->get_db()->query($sql)) && $res->numRows() > 0) {
             $this->set_error_code(2418);
             return false;
         }
         $tag_group->set_url($url);
         $tag_group->set_template($template);
         $tag_group->set_tag_template($tag_template);
         $tag_group->set_metadata($metadata);
         $this->_post_master->set_data_object($tag_group);
         if (!$this->_post_master->sql_insert()) {
             $this->set_error_code(2412);
             return false;
         }
         $work_id = $this->_post_master->get_work_id();
         $um->register_url(urlencode($url), 'lib/vivvo/url_handlers/topic.php', 'topic_url_handler', 'topic_content_handler');
         $um->set_param('search_id', $work_id);
         if ($new_tags) {
             $this->add_tag_names_to_topic($new_tags, $work_id);
         }
         admin_log($user->get_username(), 'Added topic #' . $work_id);
         return $work_id;
     }
     $this->set_error_code(2410);
     return false;
 }
Esempio n. 10
0
 public function has_value($name)
 {
     is_null(self::$lang) and self::$lang = vivvo_lang::get_instance();
     if (is_array($this->_replacments) && key_exists($name, $this->_replacments)) {
         return true;
     } elseif (is_array($this->_nessted) && key_exists($name, $this->_nessted)) {
         return true;
     } elseif (self::$lang->get_value($pattern) !== false) {
         return true;
     } elseif ($this->_parent_template) {
         return $this->_parent_template->has_value($name);
     }
     return defined($name);
 }
Esempio n. 11
0
 /**
  * Edit category
  *
  * @param	integer	$category_id
  * @param	array	$data
  * @return	boolean	true on success or false on fail
  */
 function edit_category($category_id, $data)
 {
     if (!$this->check_token()) {
         return false;
     }
     if (!vivvo_hooks_manager::call('category_edit', array(&$category_id, &$data))) {
         return vivvo_hooks_manager::get_status();
     }
     $sm = vivvo_lite_site::get_instance();
     if ($sm->user) {
         if ($sm->user->is_admin()) {
             $category_id = (int) $category_id;
             if (isset($data['category_name'])) {
                 $data['category_name'] = trim($data['category_name']);
             }
             if (empty($data['sefriendly'])) {
                 if (isset($data['category_name']) && !empty($data['category_name'])) {
                     $data['sefriendly'] = make_sefriendly($data['category_name']);
                 }
             } else {
                 $data['sefriendly'] = make_sefriendly($data['sefriendly']);
             }
             if (isset($data['sefriendly'])) {
                 $sefriendly = secure_sql($data['sefriendly']);
                 $sql = 'SELECT id FROM ' . VIVVO_DB_PREFIX . "categories WHERE sefriendly = '{$sefriendly}' AND id <> {$category_id} LIMIT 1 UNION\n\t\t\t\t\t\t\t\tSELECT id FROM " . VIVVO_DB_PREFIX . "tags_groups WHERE url = '{$sefriendly}' LIMIT 1";
                 if (($res = $sm->get_db()->query($sql)) && $res->numRows() > 0) {
                     $this->set_error_code(2101);
                     return false;
                 }
             }
             $category_list = $sm->get_categories();
             $category = $category_list->list[$category_id];
             $redirect = $in_category['redirect'];
             array_walk($in_category, 'array_htmlspecialchars');
             $in_category['redirect'] = $redirect;
             if (!empty($data['form']) and $data['form'] == 'link' and empty($data['redirect'])) {
                 $this->set_error_code(12, vivvo_lang::get_instance()->get_value('LNG_DB_categories_redirect'));
                 return false;
             }
             if (isset($category)) {
                 if (!$category->populate($data, true)) {
                     $this->set_error_info($category->get_error_info());
                     return false;
                 }
                 $this->_post_master->set_data_object($category);
                 if ($this->_post_master->sql_update()) {
                     $fm = $sm->get_file_manager();
                     if ($fm->is_uploaded('CATEGORY_abstact_image')) {
                         $abstract_image = $fm->upload('CATEGORY_abstact_image');
                         if ($abstract_image != false) {
                             $category->set_image($abstract_image);
                             $this->_post_master->set_data_object($category);
                             $this->_post_master->sql_update();
                         }
                     }
                     admin_log($sm->user->get_username(), 'Edited category #' . $category_id);
                     return true;
                 } else {
                     $this->set_error_code(2110);
                     return false;
                 }
             } else {
                 $this->set_error_code(2111);
                 return false;
             }
         } else {
             $this->set_error_code(2112);
             return false;
         }
     } else {
         $this->set_error_code(2113);
         return false;
     }
 }
Esempio n. 12
0
 function email_to_a_friend($article_id, $to, $bcc, $your_email, $message)
 {
     require_once VIVVO_FS_FRAMEWORK . 'PEAR/Mail.php';
     if (!vivvo_hooks_manager::call('article_mail', array(&$article_id, &$to, &$bcc, &$your_email, &$message))) {
         return vivvo_hooks_manager::get_status();
     }
     if (VIVVO_EMAIL_ENABLE == 1) {
         if (isset($_SESSION['vivvo']['email_to_friend_time']) && $_SESSION['vivvo']['email_to_friend_time'] + VIVVO_EMAIL_FLOOD_CHECK > VIVVO_START_TIME) {
             $this->set_error_code(2202);
             return false;
         }
         $article_list = new Articles_list();
         $article = $article_list->get_article_by_id($article_id);
         $lang = vivvo_lang::get_instance();
         if ($article !== false) {
             $to = strip_tags($to);
             $bcc = strip_tags($bcc);
             if (!preg_match('/^[a-zA-Z0-9_\\-\\/\\.]+@[a-zA-Z0-9_\\-\\/]{2,}([\\.][a-zA-Z0-9_\\-\\/]{2,}){1,}$/', $your_email)) {
                 $this->set_error_code(2032);
                 return false;
             }
             if (!preg_match('/^[a-zA-Z0-9_\\-\\/\\.]+@[a-zA-Z0-9_\\-\\/]{2,}([\\.][a-zA-Z0-9_\\-\\/]{2,}){1,}$/', $bcc)) {
                 $bcc = '';
             }
             if (VIVVO_EMAIL_SEND_BCC) {
                 if ($bcc) {
                     $bcc .= ', ' . VIVVO_EMAIL_SEND_BCC;
                 } else {
                     $bcc = VIVVO_EMAIL_SEND_BCC;
                 }
             }
             if (VIVVO_EMAIL_SEND_CC) {
                 $headers['Cc'] = VIVVO_EMAIL_SEND_CC;
             }
             if (preg_match('/^[a-zA-Z0-9_\\-\\/\\.]+@[a-zA-Z0-9_\\-\\/]{2,}([\\.][a-zA-Z0-9_\\-\\/]{2,}){1,}$/', $to)) {
                 $body_template = new template();
                 $template_sting = xml_template_node::xmlentities_decode(VIVVO_EMAIL_TO_A_FRIEND_BODY);
                 $body_template->set_string_template($template_sting);
                 $body_template->assign('article', $article);
                 $body_template->assign('user_email_address', $your_email);
                 $body_template->assign('message', $message);
                 $body = $body_template->get_output() . "\n\n";
                 $headers['From'] = $your_email;
                 $recipients = array();
                 $recipients[] = $to;
                 if ($bcc != '') {
                     $headers['Bcc'] = $bcc;
                 }
                 $headers['Subject'] = "=?UTF-8?B?" . base64_encode(VIVVO_EMAIL_TO_A_FRIEND_SUBJECT) . "?=";
                 $headers['Content-Type'] = "text/plain; charset=UTF-8;";
                 if (VIVVO_EMAIL_SMTP_PHP == 1) {
                     $mail_object = new Mail();
                     $mail_object->send($to, $headers, $body);
                 } else {
                     $mail_options['driver'] = 'smtp';
                     $mail_options['host'] = VIVVO_EMAIL_SMTP_HOST;
                     $mail_options['port'] = VIVVO_EMAIL_SMTP_PORT;
                     $mail_options['localhost'] = 'localhost';
                     if (VIVVO_EMAIL_SMTP_PASSWORD != '' && VIVVO_EMAIL_SMTP_USERNAME != '') {
                         $mail_options['auth'] = true;
                         $mail_options['username'] = VIVVO_EMAIL_SMTP_USERNAME;
                         $mail_options['password'] = VIVVO_EMAIL_SMTP_PASSWORD;
                     } else {
                         $mail_options['auth'] = false;
                         $mail_options['username'] = '';
                         $mail_options['password'] = '';
                     }
                     $mail_object = Mail::factory('smtp', $mail_options);
                     $mail_object->send($to, $headers, $body);
                 }
                 $article->set_emailed($article->emailed + 1);
                 $this->_post_master->set_data_object($article);
                 if ($this->_post_master->sql_update()) {
                     $_SESSION['vivvo']['email_to_friend_time'] = time();
                     return true;
                 } else {
                     $this->set_error_code(2033);
                     return false;
                 }
             } else {
                 $this->set_error_code(2034);
                 return false;
             }
         } else {
             $this->set_error_code(2035);
             return false;
         }
     }
 }
Esempio n. 13
0
 /**
  * Generates box output
  *
  * @param	array	$params		Parameters passed from VTE
  */
 public function generate_output($params = array())
 {
     if (empty($params['name']) or empty(self::$hooks[$params['name']])) {
         return;
     }
     !empty($params['template_set']) or $params['template_set'] = self::$template_set;
     if (empty($params['template_string'])) {
         $filename = VIVVO_FS_TEMPLATE_ROOT . "templates/_system/hooks/{$params['template_set']}/{$params['name']}.xml";
         if (is_file($filename)) {
             $params['template_string'] = file_get_contents($filename);
         } else {
             return;
         }
     }
     if (!$this->_parent_template) {
         $this->_parent_template = vivvo_lite_site::get_instance()->get_template();
     }
     $output = '';
     foreach (self::$hooks[$params['name']] as &$hook) {
         $template = new template(vivvo_lite_site::get_instance(), $this->_parent_template);
         $template->set_string_template($params['template_string']);
         if (!empty($hook['handler'])) {
             if (!$hook['handler']['loaded']) {
                 if (is_file(VIVVO_FS_INSTALL_ROOT . $hook['handler']['file'])) {
                     include_once VIVVO_FS_INSTALL_ROOT . $hook['handler']['file'];
                 }
                 if (!empty($hook['handler']['class'])) {
                     if (class_exists($hook['handler']['class']) and in_array($hook['handler']['function'], get_class_methods($hook['handler']['class']))) {
                         $hook['handler']['function'] = array($hook['handler']['class'], $hook['handler']['function']);
                         $hook['handler']['loaded'] = true;
                     }
                 } else {
                     if (function_exists($hook['handler']['function'])) {
                         $hook['handler']['loaded'] = true;
                     }
                 }
             }
             if ($hook['handler']['loaded']) {
                 $ret = call_user_func_array($hook['handler']['function'], array($template, $params, &$hook, $hook['handler']['params']));
                 if ($ret !== true) {
                     $output .= $ret;
                     continue;
                 }
             }
         }
         if (!empty($hook['params'])) {
             if (!empty($hook['params']['lang_file'])) {
                 vivvo_lang::get_instance()->load_lang(defined('VIVVO_ADMIN_LANG') ? VIVVO_ADMIN_LANG : VIVVO_DEFAULT_LANG, $template->eval_string($hook['params']['lang_file']));
             }
             foreach ($hook['params'] as $name => $value) {
                 $value = $template->eval_string($value);
                 $template->assign($name, $value);
             }
             $output .= $template->get_output();
         }
     }
     unset($hook);
     $this->set_template(array('template_string' => '<vte:value select="{output}" />'));
     $this->_template->assign('output', $output);
 }
Esempio n. 14
0
 function generate_output($params)
 {
     $this->set_template($params);
     $sm = vivvo_lite_site::get_instance();
     $um = $sm->get_url_manager();
     $lang = vivvo_lang::get_instance();
     if (!isset($params['search_by_year']) && !$um->isset_param('search_by_year')) {
         $year = date('Y', VIVVO_START_TIME);
         $params['search_by_year'] = $year;
     } else {
         if (isset($params['search_by_year'])) {
             $year = (int) $params['search_by_year'];
         } else {
             $year = (int) $um->get_param('search_by_year');
             $params['search_by_year'] = $year;
         }
     }
     if (!isset($params['search_by_month']) && !$um->isset_param('search_by_month')) {
         $month = date('n', VIVVO_START_TIME);
         $params['search_by_month'] = $month;
     } else {
         if (isset($params['search_by_month'])) {
             $month = (int) $params['search_by_month'];
         } else {
             $month = (int) $um->get_param('search_by_month');
             $params['search_by_month'] = $month;
         }
     }
     //Articles per day
     if ($month > 0 && $year > 1900) {
         if (!isset($params['search_do_advanced'])) {
             $params['search_status'] = -1;
         }
         require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Articles.class.php';
         $article_params = Articles_list::get_search_params(null, $params);
         $article_list = new Articles_list();
         $article_list->search($article_params['search_options'], '', 'ascending', 0, 0, false);
         $article_list->_query->_fields = array();
         $article_list->_query->add_fields('DAYOFMONTH( created ) AS day');
         $article_list->_query->add_fields('count( * ) AS count');
         $article_list->_query->add_group_by('TO_DAYS( created )');
         $query = $article_list->_query->get_query();
         $num_of_days = date('t', mktime(0, 0, 0, $month, 1, $year));
         $day_of_week = date('w', mktime(0, 0, 0, $month, 1, $year));
         $prev_month = $month - 1;
         if ($prev_month == 0) {
             $prev_month = 12;
             $prev_year = $year - 1;
         } else {
             $prev_year = $year;
         }
         $next_month = $month + 1;
         if ($next_month == 13) {
             $next_month = 1;
             $next_year = $year + 1;
         } else {
             $next_year = $year;
         }
         $prev_num_of_days = date('t', mktime(0, 0, 0, $prev_month, 1, $prev_year));
         if ($day_of_week != 0) {
             for ($i = 1 - $day_of_week; $i <= 0; $i++) {
                 $this->data[$i] = array();
                 $this->data[$i]['label'] = '';
                 $this->data[$i]['count'] = 0;
                 $this->data[$i]['url'] = '';
             }
         }
         for ($i = 1; $i <= $num_of_days; $i++) {
             $this->data[$i] = array();
             $this->data[$i]['label'] = $i;
             $this->data[$i]['count'] = 0;
             $this->data[$i]['url'] = '';
         }
         $next_day_of_week = date('w', mktime(0, 0, 0, $month, $num_of_days, $year));
         if ($next_day_of_week != 6) {
             for ($i = $num_of_days + 1; $i < $num_of_days + 6 - $next_day_of_week + 1; $i++) {
                 $this->data[$i] = array();
                 $this->data[$i]['label'] = '';
                 $this->data[$i]['count'] = 0;
                 $this->data[$i]['url'] = '';
             }
         }
         $count_sum = 0;
         $res = $sm->get_db()->query($query);
         if (!is_a($res, 'mdb2_error')) {
             while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) {
                 if ($row['count'] > 0) {
                     $count_sum += $row['count'];
                     $this->data[$row['day']]['count'] += $row['count'];
                     if (isset($params['search_status']) && $params['search_status'] == -1) {
                         $this->data[$row['day']]['url'] = make_proxied_url('archive/' . $year . '/' . $month . '/' . $row['day']);
                     } else {
                         $day_params = $article_params;
                         $day_params['search_do_advanced'] = true;
                         $day_params['search_by_day'] = $row['day'];
                         $search_option = base64_encode(serialize($day_params));
                         $this->data[$row['day']]['url'] = make_absolute_url('index.php?search_options=' . $search_option);
                     }
                 }
             }
         }
         $res->free();
     }
     if ($count_sum) {
         $month_params = $article_params;
         if (isset($params['search_status']) && $params['search_status'] == -1) {
             $this->_template->assign('month_url', make_proxied_url('archive/' . $year . '/' . $month . '/'));
         } else {
             $month_params['search_do_advanced'] = true;
             $search_option = base64_encode(serialize($month_params));
             $this->_template->assign('month_url', make_absolute_url('index.php?search_options=' . $search_option));
         }
     }
     $this->_template->assign('count_list', $this->data);
     $this->_template->assign('year', $year);
     $this->_template->assign('month', strval($lang->get_value('LNG_MONTH_' . $month)));
     $this->_template->assign('prev_year', intval($year - 1));
     $this->_template->assign('prev_month_year', $prev_year);
     $this->_template->assign('prev_month', $prev_month);
     $this->_template->assign('next_year', intval($year + 1));
     $this->_template->assign('next_month_year', $next_year);
     $this->_template->assign('next_month', $next_month);
 }
 function load_admin_lang()
 {
     $pm = vivvo_lite_site::get_instance()->get_plugin_manager();
     $lang = vivvo_lang::get_instance();
     $lang->load_lang(VIVVO_ADMIN_LANG, $pm->plugins['image_gallery']['root_dir'] . 'admin/lang/');
 }
Esempio n. 16
0
 /**
  * Add subscriber to mailing list
  *
  * @param	array	$data
  * @return	boolean	true on succes, or false on fail
  */
 function add_subscriber($data)
 {
     $lang = vivvo_lang::get_instance();
     $subsciber = new maillist();
     if (!preg_match("/^[-_a-z0-9]+(\\.[-_a-z0-9]+)*@[-a-z0-9]+(\\.[-a-z0-9]+)*\\.[a-z]{2,6}\$/", $data['email'])) {
         $this->set_error_code(10251);
         return false;
     }
     $email_list = new maillist_list();
     if ($email_list->get_subscriber_by_email($data['email']) === false) {
         $data['ip'] = $_SERVER['REMOTE_ADDR'];
         $data['confirm'] = '0';
         $data['domain_id'] = '1';
         $data['time'] = time();
         if ($subsciber->populate($data, true) === false) {
             return false;
         }
         $this->_post_master->set_data_object($subsciber);
         if ($this->_post_master->sql_insert()) {
             $crypt = md5($data['email'] . $data['ip'] . $data['time']);
             $confirm_url = VIVVO_PROXY_URL . 'newsletter/index.html?action=newsletter&cmd=subscriberConfirm&ack=' . $crypt;
             if (!preg_match('/^[^:]+:/', $confirm_url)) {
                 $confirm_url = VIVVO_URL . $confirm_url;
             }
             $search = array('(', ')', '<', '>', '@', ';', ':', '\\', '"', '.', '[', ']');
             $replace = array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
             $vivvo_website_title = str_replace($search, $replace, VIVVO_WEBSITE_TITLE);
             $vivvo_website_title = "=?UTF-8?B?" . base64_encode($vivvo_website_title) . "?=";
             $headers['From'] = $vivvo_website_title . '<' . VIVVO_EMAIL_SEND_FROM . '>';
             $recipients = array();
             $recipients[] = $data['email'];
             $headers['To'] = $data['email'];
             $headers['Subject'] = "=?UTF-8?B?" . base64_encode(VIVVO_PLUGIN_NEWSLETTER_SUBSCRIBE_SUBJECT) . "?=";
             $headers['Content-Type'] = "text/plain; charset=UTF-8;";
             vivvo_lite_site::get_instance()->set_template();
             $body_template = new template();
             $template_sting = xml_template_node::xmlentities_decode(VIVVO_PLUGIN_NEWSLETTER_SUBSCRIBE_BODY);
             $body_template->set_string_template($template_sting);
             $body_template->assign('email', $data['email']);
             $body_template->assign('activation_url', $confirm_url);
             $body = $body_template->get_output() . "\n\n";
             if (VIVVO_EMAIL_SMTP_PHP == 1) {
                 $mail_object = new Mail();
                 $mail_object->send($recipients, $headers, $body);
             } else {
                 $mail_options['driver'] = 'smtp';
                 $mail_options['host'] = VIVVO_EMAIL_SMTP_HOST;
                 $mail_options['port'] = VIVVO_EMAIL_SMTP_PORT;
                 $mail_options['localhost'] = 'localhost';
                 if (VIVVO_EMAIL_SMTP_PASSWORD != '' && VIVVO_EMAIL_SMTP_USERNAME != '') {
                     $mail_options['auth'] = true;
                     $mail_options['username'] = VIVVO_EMAIL_SMTP_USERNAME;
                     $mail_options['password'] = VIVVO_EMAIL_SMTP_PASSWORD;
                 } else {
                     $mail_options['auth'] = false;
                     $mail_options['username'] = '';
                     $mail_options['password'] = '';
                 }
                 $mail_object =& Mail::factory('smtp', $mail_options);
                 $mail_object->send($recipients, $headers, $body);
             }
             return true;
         } else {
             $this->set_error_code(10252);
             return false;
         }
     } else {
         $this->set_error_code(10253);
         return false;
     }
 }
Esempio n. 17
0
 function forgot_mail($username, $email)
 {
     if (!$this->check_token()) {
         return false;
     }
     if (!vivvo_hooks_manager::call('login_forgotMail', array(&$username, &$email))) {
         return vivvo_hooks_manager::get_status();
     }
     if (isset($_SESSION['vivvo']['register_time']) && $_SESSION['vivvo']['register_time'] + 60 > VIVVO_START_TIME) {
         $this->set_error_code(2755);
         return false;
     }
     require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Users.class.php';
     $lang = vivvo_lang::get_instance();
     $user_list = new Users_list();
     if (!$username && !$email) {
         $this->set_error_code(2712);
         return false;
     } else {
         if ($username) {
             $user_list->search(array('search_username' => $username));
             $user = current($user_list->list);
         } elseif ($email) {
             $user_list->search(array('search_email_address' => $email));
             $user = current($user_list->list);
         }
         if ($user) {
             $search = array('(', ')', '<', '>', '@', ';', ':', '\\', '"', '.', '[', ']');
             $replace = array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
             $vivvo_website_title = str_replace($search, $replace, VIVVO_WEBSITE_TITLE);
             $vivvo_website_title = "=?UTF-8?B?" . base64_encode($vivvo_website_title) . "?=";
             $headers['From'] = $vivvo_website_title . '<' . VIVVO_EMAIL_SEND_FROM . '>';
             $recipients = array();
             $recipients[] = $user->email_address;
             $headers['Subject'] = "=?UTF-8?B?" . base64_encode(VIVVO_EMAIL_FORGOT_SUBJECT) . "?=";
             $headers['Content-Type'] = "text/plain; charset=UTF-8;";
             $body_template = new template();
             $template_sting = xml_template_node::xmlentities_decode(VIVVO_EMAIL_FORGOT_BODY);
             $body_template->set_string_template($template_sting);
             $confirm_url = make_absolute_url('login.html?activation_key=' . md5($user->username . $user->email_address . $user->password));
             $body_template->assign('activation_url', $confirm_url);
             $body_template->assign('user', $user);
             $body = $body_template->get_output() . "\n\n";
             if (VIVVO_EMAIL_SMTP_PHP == 1) {
                 $mail_object = new Mail();
                 $mail_object->send($recipients, $headers, $body);
             } else {
                 $mail_options['driver'] = 'smtp';
                 $mail_options['host'] = VIVVO_EMAIL_SMTP_HOST;
                 $mail_options['port'] = VIVVO_EMAIL_SMTP_PORT;
                 $mail_options['localhost'] = 'localhost';
                 if (VIVVO_EMAIL_SMTP_PASSWORD != '' && VIVVO_EMAIL_SMTP_USERNAME != '') {
                     $mail_options['auth'] = true;
                     $mail_options['username'] = VIVVO_EMAIL_SMTP_PASSWORD;
                     $mail_options['password'] = VIVVO_EMAIL_SMTP_USERNAME;
                 } else {
                     $mail_options['auth'] = false;
                     $mail_options['username'] = '';
                     $mail_options['password'] = '';
                 }
                 $mail_object = Mail::factory('smtp', $mail_options);
                 $mail_object->send($recipients, $headers, $body);
             }
         }
         $_SESSION['vivvo']['register_time'] = time();
         return true;
     }
 }
Esempio n. 18
0
<?php

/* =============================================================================
 * $Revision: 5385 $
 * $Date: 2010-05-25 11:51:09 +0200 (Tue, 25 May 2010) $
 *
 * Vivvo CMS v4.5.2r (build 6084)
 *
 * Copyright (c) 2010, Spoonlabs d.o.o.
 * http://www.spoonlabs.com, All Rights Reserved
 *
 * Warning: This program is protected by copyright law. Unauthorized
 * reproduction or distribution of this program, or any portion of it, may
 * result in severe civil and criminal penalties, and will be prosecuted to the
 * maximum extent possible under the law. For more information about this
 * script or other scripts see http://www.spoonlabs.com
 * =============================================================================
 */
require_once dirname(__FILE__) . '/../conf.php';
require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/vivvo_lite_site.php';
define('VIVVO_SKIP_URL_PARSING', 1);
$frontend_lang = vivvo_lang::get_instance();
header('Content-Type: application/x-javascript');
echo "if(typeof(vivvo) == 'undefined') var vivvo = {};";
echo 'vivvo.lang = ' . json_encode($frontend_lang->_lang_stack) . ";\n";
echo "vivvo.lang.get = function(lang) {return (lang in vivvo.lang) ? vivvo.lang[lang] : lang };";
#EOF
Esempio n. 19
0
 /**
  * Report Inappropriate Content via e-mail
  *
  * @param	integer		$comment_id
  * @return	boolean		true on succes, or false on fail
  */
 function report_inappropriate_content($comment_id)
 {
     require_once dirname(__FILE__) . '/../../../lib/vivvo/framework/PEAR/Mail.php';
     if (!vivvo_hooks_manager::call('comment_reportInappropriateContent', array(&$comments_id))) {
         return vivvo_hooks_manager::get_status();
     }
     if (VIVVO_EMAIL_ENABLE == 1) {
         $sm = vivvo_lite_site::get_instance();
         $lang = vivvo_lang::get_instance();
         if (!$sm->user && $sm->guest_group && $sm->guest_group->group_privileges['ARTICLE_COMMENT'] > 0 || $sm->user && $sm->user->privileges['ARTICLE_COMMENT'] > 0) {
             $comment_list = new Comments_list();
             $comment = $comment_list->get_comments_by_id($comment_id);
             if ($comment !== false) {
                 if ($sm->user) {
                     $user = $sm->user->get_name();
                 } else {
                     $user = $lang->get_value('LNG_REPORT_COMMENT_GUEST_USER');
                 }
                 $body .= $comment->get_article_absolute_href() . '#comment_' . $comment->get_id() . "\n\n";
                 $body .= $lang->get_value('LNG_REPORT_COMMENT_MESSAGE_2') . ':' . "\n";
                 $body .= $comment->get_article_title() . "\n";
                 $body .= $comment->get_article_absolute_href() . "\n\n";
                 $body .= $lang->get_value('LNG_REPORT_COMMENT_IP_ADDRESS_AUTHOR_COMMENT') . ': ' . $comment->get_ip() . "\n";
                 $body .= $lang->get_value('LNG_REPORT_COMMENT_REPORTED_COMMENT_INFO') . ': ' . "\n";
                 $body .= $user . ', (IP:' . $_SERVER['REMOTE_ADDR'] . ")\n\n";
                 $body .= $lang->get_value('LNG_REPORT_COMMENT_MESSAGE_1');
                 $to = VIVVO_ADMINISTRATORS_EMAIL;
                 $headers['From'] = VIVVO_EMAIL_SEND_FROM;
                 $headers['To'] = VIVVO_ADMINISTRATORS_EMAIL;
                 $subject = str_replace('<WEBSITE_TITLE>', VIVVO_WEBSITE_TITLE, $lang->get_value('LNG_REPORT_COMMENT_MAIL_SUBJECT'));
                 $headers['Subject'] = "=?UTF-8?B?" . base64_encode($subject) . "?=";
                 $headers['Content-Type'] = "text/plain; charset=UTF-8;";
                 if (VIVVO_EMAIL_SMTP_PHP == 1) {
                     $mail_object = new Mail();
                     $mail_object->send($to, $headers, $body);
                 } else {
                     $mail_options['driver'] = 'smtp';
                     $mail_options['host'] = VIVVO_EMAIL_SMTP_HOST;
                     $mail_options['port'] = VIVVO_EMAIL_SMTP_PORT;
                     $mail_options['localhost'] = 'localhost';
                     if (VIVVO_EMAIL_SMTP_PASSWORD != '' && VIVVO_EMAIL_SMTP_USERNAME != '') {
                         $mail_options['auth'] = true;
                         $mail_options['username'] = VIVVO_EMAIL_SMTP_USERNAME;
                         $mail_options['password'] = VIVVO_EMAIL_SMTP_PASSWORD;
                     } else {
                         $mail_options['auth'] = false;
                         $mail_options['username'] = '';
                         $mail_options['password'] = '';
                     }
                     $mail_object = Mail::factory('smtp', $mail_options);
                     $mail_object->send($to, $headers, $body);
                 }
                 return true;
             } else {
                 $this->set_error_code(2219);
                 return false;
             }
         } else {
             $this->set_error_code(2220);
             return false;
         }
     }
 }
Esempio n. 20
0
 /**
  * Populate object properties array data
  *
  * @param array $array data in array
  */
 function populate($array, $dump = NULL)
 {
     if (is_null($dump)) {
         $dump = $this->dump;
     }
     if ($dump) {
         $missing = array();
         $lang = vivvo_lang::get_instance();
     }
     $status = true;
     if (is_array($array) && !empty($array)) {
         foreach ($array as $key => $value) {
             if (vivvo_property_exists(get_class($this), $key)) {
                 if ($this->{'set_' . $key}($value) === false) {
                     if ($dump) {
                         $missing[] = $lang->get_value('LNG_DB_' . substr($this->_sql_table, strlen(VIVVO_DB_PREFIX)) . '_' . $key);
                     }
                     $status = false;
                 }
             } else {
                 $this->__set($key, $value);
             }
         }
     }
     if ($dump && !empty($missing)) {
         $this->set_error_code(12, implode(', ', $missing));
     }
     return $status;
 }
Esempio n. 21
0
 * Warning: This program is protected by copyright law. Unauthorized
 * reproduction or distribution of this program, or any portion of it, may
 * result in severe civil and criminal penalties, and will be prosecuted to the
 * maximum extent possible under the law. For more information about this
 * script or other scripts see http://www.spoonlabs.com
 * =============================================================================
 */
require_once dirname(__FILE__) . '/admin_include.php';
require_once VIVVO_FS_INSTALL_ROOT . 'lib/backup/mysql_backup.php';
defined('VIVVO_MAINTENANCE_BACKUP_MAX_ROWS_PER_RUN') or define('VIVVO_MAINTENANCE_BACKUP_MAX_ROWS_PER_RUN', 5000);
defined('VIVVO_MAINTENANCE_RELATE_MAX_ROWS_PER_RUN') or define('VIVVO_MAINTENANCE_RELATE_MAX_ROWS_PER_RUN', 100);
if (!$sm->user->is_admin()) {
    header('Location: index.php');
    exit;
}
$lang = vivvo_lang::get_instance();
set_time_limit(20 * 60 * 60);
$start_time = microtime();
ignore_user_abort();
$restoreDropTable = false;
/**
 * Compress file on disk
 *
 * @param	string	$source
 * @param	int		$level
 * @return	string|false
 */
function gzcompressfile($source, $level = false)
{
    if (file_exists($source)) {
        $dest = $source . '.gz';
 function load_admin_lang()
 {
     $pm = vivvo_lite_site::get_instance()->get_plugin_manager();
     $lang = vivvo_lang::get_instance();
     $lang->load_lang(VIVVO_ADMIN_LANG, $pm->plugins['multiple_attachments']['root_dir'] . 'admin/lang/');
 }