Example #1
0
function OpcionesBusqueda($retorno)
{
    global $action;
    $ot = getTemplate("xulBusquedaAvanzada");
    if (!$ot) {
        error(__FILE__ . __LINE__, "Info: template no encontrado");
        return false;
    }
    $idprov = getSesionDato("FiltraProv");
    $idmarca = getSesionDato("FiltraMarca");
    $idcolor = getSesionDato("FiltraColor");
    $idtalla = getSesionDato("FiltraTalla");
    $idfamilia = getSesionDato("FiltraFamilia");
    $ot->fijar("action", $action);
    $ot->fijar("pagRetorno", $retorno);
    $ot->fijar("comboProveedores", genXulComboProveedores($idprov));
    $ot->fijar("comboMarcas", genXulComboMarcas($idmarca));
    $ot->fijar("comboFamilias", genXulComboMarcas($idfamilia));
    //echo q($idcolor,"color a mostrar en template");
    //echo q(intval($idcolor),"intval color a mostrar en template");
    if (intval($idcolor) >= 0) {
        $ot->fijar("comboColores", genXulComboColores($idcolor));
    } else {
        $ot->fijar("comboColores", genXulComboColores("ninguno"));
    }
    $ot->fijar("comboTallas", genXulComboTallas($idtalla));
    echo $ot->Output();
}
Example #2
0
function GenEtiqueta($id, $precio = 0)
{
    global $action;
    $ot = getTemplate("Etiqueta");
    if (!$ot) {
        error(__FILE__ . __LINE__, "Info: template busqueda no encontrado");
        echo "1!";
        return false;
    }
    $oProducto = new producto();
    if (!$oProducto->Load($id)) {
        error(__FILE__ . __LINE__, "Info: producto no encontrado");
        echo "2!";
        return false;
    }
    $bar = $oProducto->getCB();
    $nombre = $oProducto->getDescripcion();
    $marca = $oProducto->getMarcaTexto();
    $nombre = $nombre . ' ' . $marca;
    $cr = "&";
    $cad = "barcode=" . $bar . $cr;
    $cad .= "format=gif" . $cr;
    $cad .= "text={$bar}" . $cr;
    $cad .= "text=" . urlencode($nombre . " - " . $oProducto->get("Referencia")) . $cr;
    $cad .= "width=" . getParametro("AnchoBarras") . $cr;
    $cad .= "height=" . getParametro("AltoBarras") . $cr;
    $urlbarcode = "modulos/barcode/barcode.php?" . $cad;
    $ot->fijar("urlbarcode", $urlbarcode);
    $ot->fijar("precio", FormatMoney($precio));
    $ot->fijar("talla", $oProducto->getTextTalla());
    $ot->fijar("color", $oProducto->getTextColor());
    $ot->fijar("referencia", $oProducto->get("Referencia"));
    $ot->fijar("nombre", $nombre);
    echo $ot->Output();
}
Example #3
0
/**
 * Prints Question on screen.
 *
 * @param string The question
 * @param string File which will be called with POST if user clicks yes
 * @param array Values which will be given to $yesfile. Format: array(variable1=>value1, variable2=>value2, variable3=>value3)
 * @param string Name of the target eg Domain or eMail address etc.
 *
 * @author Florian Lippert <*****@*****.**>
 */
function ask_yesno($text, $yesfile, $params = array(), $targetname = '')
{
    global $userinfo, $db, $s, $header, $footer, $lng;
    /*
            // For compatibility reasons (if $params contains a string like "field1=value1;field2=value2") this will convert it into a usable array
            if(!is_array($params))
            {
                $params_tmp=explode(';',$params);
                unset($params);
                $params=array();
                while(list(,$param_tmp)=each($params_tmp))
                {
                    $param_tmp=explode('=',$param_tmp);
                    $params[$param_tmp[0]]=$param_tmp[1];
                }
            }
    */
    $hiddenparams = '';
    if (is_array($params)) {
        foreach ($params as $field => $value) {
            $hiddenparams .= '<input type="hidden" name="' . htmlspecialchars($field) . '" value="' . htmlspecialchars($value) . '" />' . "\n";
        }
    }
    if (isset($lng['question'][$text])) {
        $text = $lng['question'][$text];
    }
    $text = strtr($text, array('%s' => $targetname));
    eval('echo "' . getTemplate('misc/question_yesno', '1') . '";');
    exit;
}
Example #4
0
function displayPage($name, $html_dirs = NULL)
{
    global $CurrentPageName;
    global $CurrentPageDirectory;
    global $ActiveButton;
    // Save name as a global
    $CurrentPageName = $name;
    // Initialize directory as a global
    $CurrentPageDirectory = HOME_DIR;
    // Assume page name is active button
    $ActiveButton = $name;
    // Set default for html directories
    if (!is_array($html_dirs)) {
        $html_dirs = array(HOME_DIR);
    }
    // See if the site is offline
    if (file_exists("OFFLINE")) {
        getTemplate("offlineTemplate.php");
    } elseif (!preg_match("/^[a-z0-9\\-]*\$/i", $name)) {
        getTemplate("notfoundTemplate.php");
    } else {
        $found = false;
        foreach ($html_dirs as $dir) {
            if (file_exists("{$dir}/{$name}.html")) {
                $CurrentPageDirectory = "{$dir}/";
                $found = true;
                getTemplate("pageTemplate.php");
                break;
            }
        }
        if (!$found) {
            getTemplate("notfoundTemplate.php");
        }
    }
}
/**
 * This file is part of the Froxlor project.
 * Copyright (c) 2003-2009 the SysCP Team (see authors).
 * Copyright (c) 2010 the Froxlor Team (see authors).
 *
 * For the full copyright and license information, please view the COPYING
 * file that was distributed with this source code. You can also view the
 * COPYING file online at http://files.froxlor.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Florian Lippert <*****@*****.**> (2003-2009)
 * @author     Froxlor team <*****@*****.**> (2010-)
 * @license    GPLv2 http://files.froxlor.org/misc/COPYING.txt
 * @package    Functions
 *
 */
function getFormFieldOutputBool($fieldname, $fielddata)
{
    $label = $fielddata['label'];
    $boolswitch = makeYesNo($fieldname, '1', '0', $fielddata['value']);
    eval("\$returnvalue = \"" . getTemplate("formfields/bool", true) . "\";");
    return $returnvalue;
}
/**
 * Prints one ore more errormessages on screen
 *
 * @param array Errormessages
 * @param string A %s in the errormessage will be replaced by this string.
 * @author Florian Lippert <*****@*****.**>
 * @author Ron Brand <*****@*****.**>
 */
function standard_error($errors = '', $replacer = '')
{
    global $db, $userinfo, $s, $header, $footer, $lng;
    $replacer = htmlentities($replacer);
    if (!is_array($errors)) {
        $errors = array($errors);
    }
    $error = '';
    foreach ($errors as $single_error) {
        if (isset($lng['error'][$single_error])) {
            $single_error = $lng['error'][$single_error];
            $single_error = strtr($single_error, array('%s' => $replacer));
        } else {
            $error = 'Unknown Error (' . $single_error . '): ' . $replacer;
            break;
        }
        if (empty($error)) {
            $error = $single_error;
        } else {
            $error .= ' ' . $single_error;
        }
    }
    eval("echo \"" . getTemplate('misc/error', '1') . "\";");
    exit;
}
Example #7
0
function displayPage($name, $html_dirs = NULL)
{
    global $CurrentPageName;
    global $CurrentPageDirectory;
    // Save name and release in globals
    $CurrentPageName = $name;
    // Initialize directory and type in globals
    $CurrentPageDirectory = HOME_DIR;
    if (!is_array($html_dirs)) {
        $html_dirs = array(HOME_DIR);
    }
    // See if the site is offline
    if (isSiteOffline()) {
        getTemplate("offlineTemplate.php");
        return;
    }
    // Make sure the page name is valid, then
    // see whether the page exists and if so, where
    // it is and what type it is...
    if (preg_match("/^[a-z0-9\\-]*\$/i", $name)) {
        foreach ($html_dirs as $dir) {
            if (file_exists("{$dir}/{$name}.html")) {
                $CurrentPageDirectory = "{$dir}/";
                getTemplate("pageTemplate.php");
                return;
            }
        }
    }
    // If we come here, display page not found
    getTemplate("notfoundTemplate.php");
}
Example #8
0
function addNewUser()
{
    // globals
    global $DB;
    global $MySelf;
    global $MB_EMAIL;
    // Sanitize the input.
    $USERNAME = $MySelf->getUsername;
    $NEW_USER = strtolower(sanitize($_POST[username]));
    // supplied new username.
    if (!ctypeAlnum($NEW_USER)) {
        makeNotice("Only characters a-z, A-Z and 0-9 are allowed as username.", "error", "Invalid Username");
    }
    /* Password busines */
    if ($_POST[pass1] != $_POST[pass2]) {
        makeNotice("The passwords did not match!", "warning", "Passwords invalid", "index.php?action=newuser", "[retry]");
    }
    $PASSWORD = encryptPassword("{$_POST['pass1']}");
    $PASSWORD_ENC = $PASSWORD;
    /* lets see if the users (that is logged in) has sufficient
     * rights to create even the most basic miner. Level 3+ is
     * needed.
     */
    if (!$MySelf->canAddUser()) {
        makeNotice("You are not authorized to do that!", "error", "Forbidden");
    }
    // Lets prevent adding multiple users with the same name.
    if (userExists($NEW_USER) >= 1) {
        makeNotice("User already exists!", "error", "Duplicate User", "index.php?action=newuser", "[Cancel]");
    }
    // So we have an email address?
    if (empty($_POST[email])) {
        // We dont!
        makeNotice("You need to supply an email address!", "error", "Account not created");
    } else {
        // We do. Clean it.
        $NEW_EMAIL = sanitize($_POST[email]);
    }
    // Inser the new user into the database!
    $DB->query("insert into users (username, password, email, addedby, confirmed) " . "values (?, ?, ?, ?, ?)", array("{$NEW_USER}", "{$PASSWORD_ENC}", "{$NEW_EMAIL}", $MySelf->getUsername(), "1"));
    // Were we successfull?
    if ($DB->affectedRows() == 0) {
        makeNotice("Could not create user!", "error");
    } else {
        // Write the user an email.
        global $SITENAME;
        $mail = getTemplate("newuser", "email");
        $mail = str_replace('{{USERNAME}}', "{$NEW_USER}", $mail);
        $mail = str_replace('{{PASSWORD}}', "{$PASSWORD}", $mail);
        $mail = str_replace('{{SITE}}', "http://" . $_SERVER['HTTP_HOST'] . "/", $mail);
        $mail = str_replace('{{CORP}}', "{$SITENAME}", $mail);
        $mail = str_replace('{{CREATOR}}', "{$USERNAME}", $mail);
        $to = $NEW_EMAIL;
        $DOMAIN = $_SERVER['HTTP_HOST'];
        $subject = "Welcome to MiningBuddy";
        $headers = "From:" . $MB_EMAIL;
        mail($to, $subject, $mail, $headers);
        makeNotice("User added and confirmation email sent.", "notice", "Account created", "index.php?action=editusers");
    }
}
Example #9
0
 protected function getInput()
 {
     global $expose;
     $options = array();
     $html = array();
     $class = $this->element['class'];
     //get template id
     $id = JRequest::getInt('id');
     $pretext = $this->element['pretext'] != NULL ? '<span class="pre-text hasTip" title="::' . JText::_($this->element['pre-desc'] ? $this->element['pre-desc'] : $this->description) . '">' . JText::_($this->element['pretext']) . '</span>' : '';
     $posttext = $this->element['posttext'] != NULL ? '<span class="post-text">' . JText::_($this->element['posttext']) . '</span>' : '';
     $wrapstart = '<div class="field-wrap clearfix ' . $class . '">';
     $wrapend = '</div>';
     $path = JPATH_ROOT . '/templates/' . getTemplate($id) . '/templateDetails.xml';
     if (file_exists($path)) {
         $xml = simplexml_load_file($path);
         if (isset($xml->positions[0])) {
             foreach ($xml->positions[0] as $position) {
                 $value = (string) $position['value'];
                 $label = (string) $position;
                 if (!$value) {
                     $value = $label;
                 }
                 $options[] = JHtml::_('select.option', $value, $value);
             }
         }
     }
     $html[] = JHtml::_('select.genericlist', $options, $this->name, '', 'value', 'text', $this->value, $this->id);
     return $wrapstart . $pretext . implode($html) . $posttext . $wrapend;
 }
Example #10
0
 /**
  * Generate a password reset token and email a link to the user.
  *
  * @return string Standard JSON envelope
  */
 public function passwordRequest()
 {
     if (!isset($_POST['email'])) {
         return $this->error('No email address provided.', false);
     }
     $email = $_POST['email'];
     if ($email == $this->config->user->email) {
         $token = md5(rand(10000, 100000));
         $tokenUrl = sprintf('%s://%s/manage/password/reset/%s', $this->utility->getProtocol(false), $_SERVER['HTTP_HOST'], $token);
         $this->user->setAttribute('passwordToken', $token);
         $templateObj = getTemplate();
         $template = sprintf('%s/email/password-reset.php', $this->config->paths->templates);
         $body = $this->template->get($template, array('tokenUrl' => $tokenUrl));
         $emailer = new Emailer();
         $emailer->setRecipients(array($this->config->user->email));
         $emailer->setSubject('Trovebox password reset request');
         $emailer->setBody($body);
         $result = $emailer->send();
         if ($result > 0) {
             return $this->success('An email was sent to reset the password.', true);
         } else {
             $this->logger->info('Unable to send email. Confirm that your email settings are correct and the email addresses are valid.');
             return $this->error('We were unable to send a password reset email.', false);
         }
     }
     return $this->error('The email address provided does not match the registered email for this site.', false);
 }
/**
 * This file is part of the Froxlor project.
 * Copyright (c) 2003-2009 the SysCP Team (see authors).
 * Copyright (c) 2010 the Froxlor Team (see authors).
 *
 * For the full copyright and license information, please view the COPYING
 * file that was distributed with this source code. You can also view the
 * COPYING file online at http://files.froxlor.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Florian Lippert <*****@*****.**> (2003-2009)
 * @author     Froxlor team <*****@*****.**> (2010-)
 * @license    GPLv2 http://files.froxlor.org/misc/COPYING.txt
 * @package    Functions
 *
 */
function getFormFieldOutputText($fieldname, $fielddata)
{
    $label = $fielddata['label'];
    $value = htmlentities($fielddata['value']);
    eval("\$returnvalue = \"" . getTemplate("formfields/text", true) . "\";");
    return $returnvalue;
}
/**
 * This file is part of the SysCP project.
 * Copyright (c) 2003-2009 the SysCP Team (see authors).
 *
 * For the full copyright and license information, please view the COPYING
 * file that was distributed with this source code. You can also view the
 * COPYING file online at http://files.syscp.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Florian Lippert <*****@*****.**>
 * @license    GPLv2 http://files.syscp.org/misc/COPYING.txt
 *
 * @version    $Id$
 */
function getFormFieldOutputString($fieldname, $fielddata)
{
    $label = $fielddata['label'];
    $value = htmlentities($fielddata['value']);
    eval('$returnvalue = "' . getTemplate('formfields/string', true) . '";');
    return $returnvalue;
}
/**
 * This file is part of the SysCP project.
 * Copyright (c) 2003-2009 the SysCP Team (see authors).
 *
 * For the full copyright and license information, please view the COPYING
 * file that was distributed with this source code. You can also view the
 * COPYING file online at http://files.syscp.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Florian Lippert <*****@*****.**>
 * @license    GPLv2 http://files.syscp.org/misc/COPYING.txt
 *
 * @version    $Id$
 */
function getFormFieldOutputBool($fieldname, $fielddata)
{
    $label = $fielddata['label'];
    $boolswitch = makeYesNo($fieldname, '1', '0', $fielddata['value']);
    eval('$returnvalue = "' . getTemplate('formfields/bool', true) . '";');
    return $returnvalue;
}
/**
 * Prints one ore more errormessages on screen
 *
 * @param array Errormessages
 * @param string A %s in the errormessage will be replaced by this string.
 * @author Florian Lippert <*****@*****.**>
 * @author Ron Brand <*****@*****.**>
 */
function standard_error($errors = '', $replacer = '')
{
    global $userinfo, $s, $header, $footer, $lng, $theme;
    $_SESSION['requestData'] = $_POST;
    $replacer = htmlentities($replacer);
    if (!is_array($errors)) {
        $errors = array($errors);
    }
    $link = '';
    if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']) !== false) {
        $link = '<a href="' . htmlentities($_SERVER['HTTP_REFERER']) . '">' . $lng['panel']['back'] . '</a>';
    }
    $error = '';
    foreach ($errors as $single_error) {
        if (isset($lng['error'][$single_error])) {
            $single_error = $lng['error'][$single_error];
            $single_error = strtr($single_error, array('%s' => $replacer));
        } else {
            $error = 'Unknown Error (' . $single_error . '): ' . $replacer;
            break;
        }
        if (empty($error)) {
            $error = $single_error;
        } else {
            $error .= ' ' . $single_error;
        }
    }
    eval("echo \"" . getTemplate('misc/error', '1') . "\";");
    exit;
}
/**
 * This file is part of the Froxlor project.
 * Copyright (c) 2003-2009 the SysCP Team (see authors).
 * Copyright (c) 2010 the Froxlor Team (see authors).
 *
 * For the full copyright and license information, please view the COPYING
 * file that was distributed with this source code. You can also view the
 * COPYING file online at http://files.froxlor.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Florian Lippert <*****@*****.**> (2003-2009)
 * @author     Froxlor team <*****@*****.**> (2010-)
 * @license    GPLv2 http://files.froxlor.org/misc/COPYING.txt
 * @package    Functions
 *
 */
function getFormFieldOutputString($fieldname, $fielddata, $do_show = true)
{
    $label = $fielddata['label'];
    $value = htmlentities($fielddata['value']);
    eval("\$returnvalue = \"" . getTemplate("formfields/string", true) . "\";");
    return $returnvalue;
}
Example #16
0
 public static function display()
 {
     $params = array();
     $params['body'] = 'dashboard.php';
     $params['title'] = 'Dashboard page';
     $params['message'] = 'Details to show the user about their projects';
     getTemplate()->display('baseplate.php', $params);
 }
Example #17
0
 public static function display()
 {
     $params = array();
     $params['body'] = 'home.php';
     $params['title'] = 'Test landing page';
     $params['message'] = 'Hello everyone';
     getTemplate()->display('baseplate.php', $params);
 }
Example #18
0
function getTemplateReContraTocho($pagina, $cajita)
{
    $html = getTemplate($pagina);
    foreach ($cajita as $remplazar => $mensaje) {
        $html = str_replace($remplazar, $mensaje, $html);
    }
    return $html;
}
Example #19
0
 protected function getInput()
 {
     global $expose;
     $html = array();
     $options = array();
     //get template id
     $id = JRequest::getInt('id');
     // Initialize some field attributes.
     $filter = '\\.png$|\\.gif$|\\.jpg$|\\.bmp$|\\.jpeg$';
     $exclude = (string) $this->element['exclude'];
     $stripExt = (string) $this->element['stripext'];
     $hideNone = (string) $this->element['hide_none'];
     //$hideDefault	= (string) $this->element['hide_default'];
     $class = $this->element['class'];
     $attr = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
     $pretext = $this->element['pretext'] != NULL ? '<span class="pre-text hasTip" title="::' . JText::_($this->element['pre-desc'] ? $this->element['pre-desc'] : $this->description) . '">' . JText::_($this->element['pretext']) . '</span>' : '';
     $posttext = $this->element['posttext'] != NULL ? '<span class="post-text">' . JText::_($this->element['posttext']) . '</span>' : '';
     $wrapstart = '<div class="field-wrap patterns clearfix ' . $class . '">';
     $wrapend = '</div>';
     // Get the path in which to search for file options.
     $directory = (string) $this->element['directory'];
     $path = JPATH_ROOT . '/templates/' . getTemplate($id) . '/images/' . $directory;
     // Prepend some default options based on field attributes.
     if (!$hideNone) {
         $options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)));
     }
     //		if (!$hideDefault) {
     //			$options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
     //		}
     // Get a list of files in the search path with the given filter.
     $files = JFolder::files($path, $filter);
     // Build the options list from the list of files.
     if (is_array($files)) {
         foreach ($files as $file) {
             // Check to see if the file is in the exclude mask.
             if ($exclude) {
                 if (preg_match(chr(1) . $exclude . chr(1), $file)) {
                     continue;
                 }
             }
             // If the extension is to be stripped, do it.
             if ($stripExt) {
                 $file = JFile::stripExt($file);
             }
             $options[] = JHtml::_('select.option', $file, $file);
         }
     }
     // Create a read-only list (no name) with a hidden input to store the value.
     if ((string) $this->element['readonly'] == 'true') {
         $html[] = JHtml::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $this->value, $this->id);
         $html[] = '<input type="hidden" name="' . $this->name . '" value="' . $this->value . '"/>';
     } else {
         $html[] = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
     }
     return $wrapstart . $pretext . implode($html) . $posttext . $wrapend;
 }
Example #20
0
function templateNewTicket($id, $user)
{
    $b = bilheteGet($id);
    if ($b['acontecimento'] == 'E') {
        $e = eventosGet($b['id_entidade']);
    } else {
        $e = provaGet($b['id_entidade']);
    }
    return getTemplate("newticket", array("NAME" => $user['nome'], "USER" => $user['email'], "TIPO" => $b['tipo'] == 'C' ? 'compra' : 'reserva', "ACONTECIMENTO" => $b['acontecimento'] == 'E' ? 'Evento' : 'Prova', "EVENTO" => $e['designacao'], "LOCAL" => $e['local_nome'], "PRECO" => $b['preco'], "QUANTIDADE" => $b['quantidade'], "TOTAL" => $b['preco'] * $b['quantidade'], "ID" => $id, "CHECKSUM_ACCEPT" => md5("ACCEPT" . $id), "CHECKSUM_REJECT" => md5("REJECT" . $id)));
}
/**
 * This file is part of the SysCP project.
 * Copyright (c) 2003-2009 the SysCP Team (see authors).
 *
 * For the full copyright and license information, please view the COPYING
 * file that was distributed with this source code. You can also view the
 * COPYING file online at http://files.syscp.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Florian Lippert <*****@*****.**>
 * @license    GPLv2 http://files.syscp.org/misc/COPYING.txt
 *
 * @version    $Id$
 */
function getFormFieldOutputHidden($fieldname, $fielddata)
{
    $returnvalue = '<input type="hidden" name="' . $fieldname . '" value="' . htmlentities($fielddata['value']) . '" />';
    if (isset($fielddata['label']) && $fielddata['label'] != '') {
        $label = $fielddata['label'];
        $value = htmlentities($fielddata['value']);
        eval('$returnvalue .= "' . getTemplate('formfields/hidden', true) . '";');
    }
    return $returnvalue;
}
Example #22
0
	/**
	  * renders a SitePage and stores output in a file in $c["cachepath"]
	  *
	  * @param integer SPID of the SitePage to render
	  * @param integer Variation-ID of the SitePage to render
	  * @param string Additional Parameters of URL.
	  */
	function renderSitePage($spid, $variation, $addparam="") {
		global $c, $db;		
		if ($c["renderstatichtml"] && !checkCC($spid)) {
			global $cc, $deploy;
			array_push($cc, $spid);
			$template = getTemplate($spid);

			if ($template != "") {
				$filename = $c["livepath"] . $template;

				$content_array = file($filename);
				$content_string = implode("", $content_array);
				forceDirectories ($c["cachepath"]);
				$full_url = $c["hostlivedocroot"] . $template . "?page=" . $spid . "&v=" . $variation.$addparam;
				$fp = fopen($full_url, "r");
				if ($fp != "") {
					while (!feof($fp)) $content .= fgets($fp, 128);
					fclose ($fp);
					
					$menuId = getDBCell("sitepage", "MENU_ID", "SPID=".$spid);
	    			$short = getPageURL($menuId, $variation);
					if (substr($short, 0, 1) == "/")
						$short = substr($short, 1);

						$allDir = $c["livepath"];
						// ensure that path exists
						$directories = explode("/", $short);

						if (count($directories) > 0) {
							for ($i = 0; $i < count($directories); $i++) {
								$thisDir = $directories[$i];

								if ($thisDir != "") {
									if (!is_dir($allDir . $thisDir)) {
										mkdir($allDir . $thisDir, 0755);
									}
									$allDir = $allDir . $thisDir . "/";
								}
							}

							// delete old index file
							@nxDelete ($allDir , "index.html");	    			
							@nxDelete ($allDir , "index.php" );
						}
	    			
	    			
	    			$index_file = fopen($allDir . "index.html", "w");
					fwrite($index_file, $content);
					fclose ($index_file);
				}
			}
			return true;
		}
	}
/**
 * Build Navigation Sidebar
 * @param array navigation data
 * @param array userinfo the userinfo of the user
 * @return string the content of the navigation bar
 *
 * @author Florian Lippert <*****@*****.**>
 */
function buildNavigation($navigation, $userinfo)
{
    $returnvalue = '';
    foreach ($navigation as $box) {
        if ((!isset($box['show_element']) || $box['show_element'] === true) && (!isset($box['required_resources']) || $box['required_resources'] == '' || isset($userinfo[$box['required_resources']]) && ((int) $userinfo[$box['required_resources']] > 0 || $userinfo[$box['required_resources']] == '-1'))) {
            $navigation_links = '';
            foreach ($box['elements'] as $element_id => $element) {
                if ((!isset($element['show_element']) || $element['show_element'] === true) && (!isset($element['required_resources']) || $element['required_resources'] == '' || isset($userinfo[$element['required_resources']]) && ((int) $userinfo[$element['required_resources']] > 0 || $userinfo[$element['required_resources']] == '-1'))) {
                    if (isset($element['url']) && trim($element['url']) != '') {
                        // append sid only to local
                        if (!preg_match('/^https?\\:\\/\\//', $element['url']) && (isset($userinfo['hash']) && $userinfo['hash'] != '')) {
                            // generate sid with ? oder &
                            if (strpos($element['url'], '?') !== false) {
                                $element['url'] .= '&s=' . $userinfo['hash'];
                            } else {
                                $element['url'] .= '?s=' . $userinfo['hash'];
                            }
                        }
                        $target = '';
                        if (isset($element['new_window']) && $element['new_window'] == true) {
                            $target = ' target="_blank"';
                        }
                        $completeLink = '<a href="' . htmlspecialchars($element['url']) . '"' . $target . ' class="menu">' . $element['label'] . '</a>';
                    } else {
                        $completeLink = $element['label'];
                    }
                    eval("\$navigation_links .= \"" . getTemplate("navigation_link", 1) . "\";");
                }
            }
            if ($navigation_links != '') {
                if (isset($box['url']) && trim($box['url']) != '') {
                    // append sid only to local
                    if (!preg_match('/^https?\\:\\/\\//', $box['url']) && (isset($userinfo['hash']) && $userinfo['hash'] != '')) {
                        // generate sid with ? oder &
                        if (strpos($box['url'], '?') !== false) {
                            $box['url'] .= '&s=' . $userinfo['hash'];
                        } else {
                            $box['url'] .= '?s=' . $userinfo['hash'];
                        }
                    }
                    $target = '';
                    if (isset($box['new_window']) && $box['new_window'] == true) {
                        $target = ' target="_blank"';
                    }
                    $completeLink = '<a href="' . htmlspecialchars($box['url']) . '"' . $target . ' class="menu">' . $box['label'] . '</a>';
                } else {
                    $completeLink = $box['label'];
                }
                eval("\$returnvalue .= \"" . getTemplate("navigation_element", 1) . "\";");
            }
        }
    }
    return $returnvalue;
}
Example #24
0
 function formEntrada($action, $esModificar)
 {
     $ot = getTemplate("AltaPerfil");
     if (!$ot) {
         return false;
     }
     $modo = $esModificar ? "modsave" : "newsave";
     $titulo = $esModificar ? _("Modificando perfil") : _("Nuevo perfil");
     $cambios = array("TITULO" => $titulo, "VALUENOMBRE" => $this->getNombre(), "TEXTNOMBRE" => _("Nombre perfil"), "HIDDENDATA" => Hidden("id", $this->getId()), "ACTION" => "{$action}?modo={$modo}", "CADMINISTRACION" => gCheck($this->is("Administracion")), "CINFORMELOCAL" => gCheck($this->is("InformeLocal")), "CINFORMES" => gCheck($this->is("Informes")), "CPRODUCTOS" => gCheck($this->is("Productos")), "CPROVEEDORES" => gCheck($this->is("Proveedores")), "CSTOCKS" => gCheck($this->is("Stocks")), "CCOMPRAS" => gCheck($this->is("Compras")), "CCLIENTES" => gCheck($this->is("Clientes")), "CTPV" => gCheck($this->is("TPV")), "CB2B" => gCheck($this->is("B2B")), "CPEDIDOSVENTA" => gCheck($this->is("PedidosVenta")), "CVERSTOCKS" => gCheck($this->is("VerStocks")), "CPRECIOS" => gCheck($this->is("Precios")), "CVENTAS" => gCheck($this->is("Ventas")), "CFINANZAS" => gCheck($this->is("Finanzas")), "CCOBROS" => gCheck($this->is("Cobros")), "CPAGOS" => gCheck($this->is("Pagos")), "CCAJAGENERAL" => gCheck($this->is("CajaGeneral")), "CCAJATPV" => gCheck($this->is("CajaTPV")), "CPRESUPUESTOS" => gCheck($this->is("Presupuestos")), "CCOMPROBANTESCOMPRA" => gCheck($this->is("ComprobantesCompra")), "CCOMPROBANTESVENTA" => gCheck($this->is("ComprobantesVenta")), "CPROMOCIONES" => gCheck($this->is("Promociones")), "CKARDEX" => gCheck($this->is("Kardex")), "CAJUSTES" => gCheck($this->is("Ajustes")), "CVERAJUSTES" => gCheck($this->is("VerAjustes")), "CALMACEN" => gCheck($this->is("Almacen")), "CSAT" => gCheck($this->is("SAT")), "CSUSCRIPCION" => gCheck($this->is("Suscripcion")), "CSERVICIOS" => gCheck($this->is("Servicios")), "TADMINISTRACION" => _("Administración"), "TINFORMELOCAL" => _("Informe local"), "TINFORMES" => _("Informes"), "TPRODUCTOS" => _("Productos"), "TPROVEEDORES" => _("Proveedores"), "TSTOCKS" => _("Stocks"), "TCOMPRAS" => _("Compras"), "TCLIENTES" => _("Clientes"), "TTPV" => _("TPV"), "TB2B" => _("B2B"), "TPEDIDOSVENTA" => _("Pedidos"), "TVERSTOCKS" => _("Ver Stocks"), "TPRECIOS" => _("Precios"), "TVENTAS" => _("Ventas"), "TFINANZAS" => _("Finanzas"), "TCOBROS" => _("Cobros"), "TPAGOS" => _("Pagos"), "TCAJAGENERAL" => _("Caja General"), "TCAJATPV" => _("Caja TPV"), "TPRESUPUESTOS" => _("Presupuestos"), "TCOMPROBANTESCOMPRA" => _("Comprobantes Compra"), "TCOMPROBANTESVENTA" => _("Comprobantes Venta"), "TPROMOCIONES" => _("Promociones"), "TKARDEX" => _("Kardex"), "TAJUSTES" => _("Ajustes"), "TALMACEN" => _("Almacén"), "TVERAJUSTES" => _("Ver Ajustes"), "TSERVICIOS" => _("Servicios"), "TSAT" => _("SAT"), "TSUSCRIPCION" => _("Suscripción"));
     return $ot->makear($cambios);
 }
Example #25
0
 public function __construct()
 {
     $this->api = getApi();
     $this->config = getConfig()->get();
     $this->plugin = getPlugin();
     $this->route = getRoute();
     $this->session = getSession();
     $this->template = getTemplate();
     $this->utility = new Utility();
     $this->url = new Url();
     $this->apiVersion = Request::getApiVersion();
 }
Example #26
0
function ListaFormaDeUnidades()
{
    //FormaListaCompraCantidades
    global $action;
    $oProducto = new producto();
    $ot = getTemplate("PopupCarritoCompra");
    if (!$ot) {
        error(__FILE__ . __LINE__, "Info: template no encontrado");
        return false;
    }
    $ot->resetSeries(array("IdProducto", "Referencia", "Nombre", "tBorrar", "tEditar", "tSeleccion", "vUnidades"));
    $tamPagina = $ot->getPagina();
    $indice = getSesionDato("PaginadorSeleccionCompras2");
    $carrito = getSesionDato("CarritoMover");
    //echo q($carrito,"Carrito Cantidades");
    $costescarrito = getSesionDato("CarroCostesMover");
    $quitar = _("Quitar");
    $ot->fijar("tTitulo", _("Carrito para Traslado"));
    //$ot->fijar("comboAlmacenes",getSesionDato("ComboAlmacenes"));
    $ot->fijar("comboAlmacenes", genComboAlmacenes(getParametro("AlmacenCentral")));
    $salta = 0;
    $num = 0;
    foreach ($carrito as $key => $value) {
        $salta++;
        if ($num <= $tamPagina and $salta >= $indice) {
            $num++;
            if ($oProducto->Load($key)) {
                $referencia = $oProducto->getReferencia();
                $nombre = $oProducto->getNombre();
            } else {
                $referencia = "";
                $nombre = "";
            }
            $ot->fijarSerie("vReferencia", $referencia);
            $ot->fijarSerie("vNombre", $nombre);
            $ot->fijarSerie("tBorrar", $quitar);
            $ot->fijarSerie("vUnidades", $value);
            $ot->fijarSerie("vPrecio", $costescarrito[$key]);
            $ot->fijarSerie("IdProducto", $oProducto->getId());
        }
    }
    if (!$salta) {
        $ot->fijar("aviso", gas("aviso", _("Carrito vacío")));
        $ot->eliminaSeccion("haydatos");
    } else {
        $ot->fijar("aviso");
        $ot->confirmaSeccion("haydatos");
    }
    $ot->paginador($indice, false, $num);
    $ot->fijar("action", $action);
    $ot->terminaSerie();
    echo $ot->Output();
}
Example #27
0
function getTemplatePath()
{
    switch (INSTALL_ENV) {
        case 'upgrade':
            return '../install/templates/' . getTemplate() . '/';
            break;
        default:
        case 'install':
            return './templates/' . getTemplate() . '/';
            break;
    }
}
Example #28
0
 /**
  * Funcion que muestra el formulario para la configuracion
  * @return void
  */
 function ingresarForm()
 {
     // Valores por defecto
     $sql = "SELECT * FROM {$this->tabla} LIMIT 1";
     $rst = $this->queryRow($sql);
     $datos = array();
     foreach ($rst as $key => $valor) {
         $datos[$key] = html_entity_decode($valor, ENT_QUOTES, "UTF-8");
     }
     include getTemplate('configuracion.php');
     return;
 }
Example #29
0
function FormularioEntrada($local)
{
    global $action;
    $ot = getTemplate("SeleccionRapidaAlmacen");
    if (!$ot) {
        error(__FILE__ . __LINE__, "Info: template busqueda no encontrado");
        return false;
    }
    $ot->fijar("action", $action . "?modo=agnade");
    $ot->fijar("IdLocal", $local);
    echo $ot->Output();
}
function getFormOverviewGroupOutput($groupname, $groupdetails)
{
    global $lng, $filename, $s, $theme;
    $group = '';
    $title = $groupdetails['title'];
    $part = $groupname;
    $activated = true;
    $option = '';
    if (isset($groupdetails['fields'])) {
        foreach ($groupdetails['fields'] as $fieldname => $fielddetails) {
            if (isset($fielddetails['overview_option']) && $fielddetails['overview_option'] == true) {
                if ($fielddetails['type'] != 'option' && $fielddetails['type'] != 'bool') {
                    standard_error('overviewsettingoptionisnotavalidfield');
                }
                if ($fielddetails['type'] == 'option') {
                    $options_array = $fielddetails['option_options'];
                    $options = '';
                    foreach ($options_array as $value => $vtitle) {
                        $options .= makeoption($vtitle, $value, Settings::Get($fielddetails['settinggroup'] . '.' . $fielddetails['varname']));
                    }
                    $option .= $fielddetails['label'] . ':&nbsp;';
                    $option .= '<select class="dropdown_noborder" name="' . $fieldname . '">';
                    $option .= $options;
                    $option .= '</select>';
                    $activated = true;
                } else {
                    $option .= $lng['admin']['activated'] . ':&nbsp;';
                    $option .= makeyesno($fieldname, '1', '0', Settings::Get($fielddetails['settinggroup'] . '.' . $fielddetails['varname']));
                    $activated = (int) Settings::Get($fielddetails['settinggroup'] . '.' . $fielddetails['varname']);
                }
            }
        }
    }
    /**
     * this part checks for the 'websrv_avail' entry in the settings
     * if found, we check if the current webserver is in the array. If this
     * is not the case, we change the setting type to "hidden", #502
     */
    $do_show = true;
    if (isset($groupdetails['websrv_avail']) && is_array($groupdetails['websrv_avail'])) {
        $websrv = Settings::Get('system.webserver');
        if (!in_array($websrv, $groupdetails['websrv_avail'])) {
            $do_show = false;
            $title .= sprintf($lng['serversettings']['option_unavailable_websrv'], implode(", ", $groupdetails['websrv_avail']));
            // hack disabled flag into select-box
            $option = str_replace('<select class', '<select disabled="disabled" class', $option);
        }
    }
    eval("\$group = \"" . getTemplate("settings/settings_overviewgroup") . "\";");
    return $group;
}