function pickup_submit()
 {
     avControl::pickup_submit();
     $name = '_f_new_' . $this->name;
     $change = 'change_file_' . $name;
     global ${$name}, ${"{$name}" . "_name"}, ${"{$name}" . "_size"}, ${$change};
     if (empty(${$change})) {
         return true;
     }
     $file = ${$name};
     if ($file == "none") {
         return true;
     }
     if (!$file) {
         return true;
     }
     if ($this->value) {
         unlink($this->dir . '/' . $this->value);
     }
     $file_name = ${"{$name}" . "_name"};
     $file_size = ${"{$name}" . "_size"};
     $file_name = clean_name($file_name);
     $dest = $this->dir . "/{$file_name}";
     while (file_exists($dest)) {
         $file_name = "_" . $file_name;
         $dest = $this->dir . "/{$file_name}";
     }
     copy($file, $dest);
     unlink($file);
     $this->value = $file_name;
 }
 /**
  * cia visa logika admin puses
  * is kur ateina popup ?
  * issiaishkinam active module ir active controlet
  * uzkraunam menu
  * uzkraunam submenu
  * atiduodam valdyma controletui
  */
 function process()
 {
     if (!empty($GLOBALS['control'])) {
         $tmp = explode('.', clean_name($GLOBALS['control']));
         $this->modulename = $tmp[0];
         isset($tmp[1]) && ($this->controletname = $tmp[1]);
     }
     if (empty($this->modulename)) {
         $this->modulename = $this->kernel->user->groupinfo['default_module'];
     }
     if (!isset($this->kernel->modules[$this->modulename])) {
         $this->kernel->errorPage(sprintf($this->kernel->lang['error.str.nomodule'], $this->modulename));
     }
     if (empty($this->controletname)) {
         $this->controletname = $this->kernel->modules[$this->modulename]->getDefaultControletName();
     }
     $this->module =& $this->kernel->modules[$this->modulename];
     $this->module->loadControlet($this->controletname);
     if ($this->module->controlet->isPopUp()) {
         return $this->module->controlet->process();
     }
     $this->kernel->tpl->set_file('control.page', MODDIR . 'control/tpl/page.control.html', 1);
     $this->kernel->tpl->set_var('module_menu', $this->getMenu());
     $this->kernel->tpl->set_var('module_submenu', $this->module->getSubMenu());
     $this->kernel->tpl->set_var('controlet_space', $this->module->controlet->process());
     return $this->kernel->tpl->process('', 'control.page');
 }
 /**
  * get page description from db, unserialize xml
  */
 function getPageInfo($iname)
 {
     $iname = clean_name($iname);
     $result = $this->kernel->db->selectRow("SELECT p.*, t.definition AS tpl_definition\n\t\t\t\t\t\tFROM fu_pages p, fu_templates t\n\t\t\t\t\t\tWHERE p.iname = '{$iname}' AND p.template = t.id");
     if (!$result) {
         return false;
     }
     // unserialize xml
     if (!empty($result['definition'])) {
         $result['definition'] = unserialize($result['definition']);
     }
     if (!empty($result['tpl_definition'])) {
         $result['tpl_definition'] = unserialize($result['tpl_definition']);
     }
     if ($result['override'] && !empty($result['override_definition'])) {
         $result['override_definition'] = unserialize($result['override_definition']);
     }
     return $result;
 }
Exemple #4
0
function get_tree($path = '.', $clean_path = '', $title = '', $first = true, $language = null)
{
    $options = get_options();
    $tree = array();
    $ignore = get_ignored();
    $dh = @opendir($path);
    $index = 0;
    // Build array of paths
    $paths = array();
    while (false !== ($file = readdir($dh))) {
        $paths[$file] = $file;
    }
    // Close the directory handle
    closedir($dh);
    // Sort paths
    sort($paths);
    if ($first && $language !== null) {
        $language_path = $language . "/";
    } else {
        $language_path = "";
    }
    // Loop through the paths
    // while(false !== ($file = readdir($dh))){
    foreach ($paths as $file) {
        // Check that this file or folder is not to be ignored
        if (!in_array($file, $ignore) && $file[0] !== '.') {
            $full_path = "{$path}/{$file}";
            $clean_sort = clean_sort($file);
            // If clean_urls is set to false and this is the first branch of the tree, append index.php to the clean_path.
            if ($options['clean_urls'] == false) {
                if ($first) {
                    $url = $clean_path . '/' . $language_path . 'index.php/' . $clean_sort;
                } else {
                    $url = $clean_path . '/' . $language_path . $clean_sort;
                }
            } else {
                $url = $clean_path . '/' . $language_path . $clean_sort;
            }
            $clean_name = clean_name($clean_sort);
            // Title
            if (empty($title)) {
                $full_title = $clean_name;
            } else {
                $full_title = $title . ': ' . $clean_name;
            }
            if (is_dir("{$path}/{$file}")) {
                // Directory
                $tree[$clean_sort] = array('type' => 'folder', 'name' => $clean_name, 'title' => $full_title, 'path' => $full_path, 'clean' => $clean_sort, 'url' => $url, 'tree' => get_tree($full_path, $url, $full_title, false, $language));
            } else {
                // File
                $tree[$clean_sort] = array('type' => 'file', 'name' => $clean_name, 'title' => $full_title, 'path' => $full_path, 'clean' => $clean_sort, 'url' => $url);
            }
        }
        $index++;
    }
    return $tree;
}
function CheckMySQLTables($link)
{
    if (count($_POST) && isset($_POST['mysql_select_tables'])) {
        $_SESSION['plugin_mysql_tables'] = $_POST;
    }
    if (isset($_SESSION['plugin_mysql_tables']) && count($_SESSION['plugin_mysql_tables'])) {
        return true;
    }
    $tbs = GetMySQLTables($link);
    echo "\r\n  <style type=\"text/css\">\r\n  .SelectVisible { display: inline; }\r\n  .SelectHidded { display: none; }\r\n  </style>\r\n  <script type=\"text/javascript\">\r\n  var CurrentTable;\r\n  var CurrentColumn;\r\n  function ShowColumns(from) {\r\n    for (var i=0; i<from.options.length; i++) {\r\n\t\t  var o = from.options[i];\r\n      if (select = document.getElementById('tr_'+o.value)) {\r\n  \t\t  if (o.selected) {\r\n          select.className = 'SelectVisible';\r\n          CurrentTable = o.value;\r\n        }\r\n\t\t    else \r\n\t\t      select.className = 'SelectHidded'; \r\n\t\t  }\r\n    }\r\n  }\r\n  function SelectColumn(id) {\r\n    CurrentColumn = document.getElementById('col_'+id);\r\n  }\r\n  function SetColValue(from) {\r\n    for (var i=0; i<from.options.length; i++) {\r\n\t\t  var o = from.options[i];\r\n\t\t  if (o.selected && CurrentColumn)\r\n        CurrentColumn.value = `'+o.value+'`';\r\n    }\r\n  }\r\n  </script>\r\n  <script type=\"text/javascript\" src=\"select.js\"></script>";
    echo '
  <form method="POST">
  <input type="hidden" name="mysql_select_tables" value="doIt">
  <table class="Insert" cellspacing="0" cellpadding="3" width="80%" style="text-align:left">
  <thead><tr><td colspan="2" class="TitleHeader">Columns Assignment</td></tr></thead>
  <tr>
   <td width="75%" align="left" nowrap="nowrap" valign="top">
   ';
    include_once 'include/SQLiteTableProperties.class.php';
    $prop = new SQLiteTableProperties($GLOBALS['workDb']);
    $prop->getTableProperties($GLOBALS['table']);
    foreach ($prop->infoTable as $key => $col_infos) {
        echo '<label for="' . $col_infos['name'] . '"><input onClick="SelectColumn(this.id);" name="column" id="' . $col_infos['name'] . '" ' . (!$key ? 'checked="checked" ' : '') . 'type="radio">';
        echo '<b>' . htmlentities($col_infos['name']) . '</b> ' . $col_infos['type'] . ' ' . ($col_infos['pk'] ? ' [PK] ' : ' ') . ' ' . ($col_infos['dflt_value'] ? 'default : ' . htmlentities($col_infos['dflt_value']) : '') . '</label><br/>' . "\n";
        echo '<input size="35" name="col_' . $col_infos['name'] . '" id="col_' . $col_infos['name'] . '" type="text" value="" class="text"><br/><br/>';
        if ($key == 0) {
            echo '<script type="text/javascript">SelectColumn("' . $col_infos['name'] . '");</script>';
        }
    }
    echo '
   </td>
   <td align="right" valign="top">
     <table><tr><td nowrap="nowrap" valign="top">Select MySQL Table to <br/>fill destination columns</td>
     <td>
     <select valign="bottom" onChange="ShowColumns(this);" name="mysql_tables[]" multiple="multiple" size="7">
     ';
    foreach ($tbs['tables'] as $tb => $rows) {
        echo "<option value=\"{$tb}\">{$tb} ({$rows})</option>";
    }
    echo '
     </select>
     </td></tr></table><table>';
    if (isset($tbs['columns'])) {
        foreach ($tbs['columns'] as $table => $columns) {
            echo '
  <tr id="tr_' . clean_name($table) . '" class="SelectHidded">
   <td align="right">Base ' . htmlentities($_SESSION['plugin_mysql_base']) . ', table <b>' . htmlentities($table) . '</b><br/>
     <select style="width:300px" onChange="SetColValue(this);return false;" size="10" name="mysql_cols_' . clean_name($table) . '[]" multiple="multiple">';
            foreach ($columns as $col => $infos) {
                echo "<option value=\"{$col}\">{$col} ({$infos})</option>";
            }
            echo '
     </select>
   </td>
  </tr>';
        }
    }
    echo '
  </td></tr></table></td>
  <tr>
   <td colspan="2" align="center"><input type="submit" class="button"></td>
  </tr>
  </table>
  </form>
  ';
    return false;
}
Exemple #6
0
        ?>
" style="cursor: pointer;">
												<div class="col-xs-10">
													<?php 
        echo $choice;
        ?>
												</div>
												<div class="col-xs-2"><i class="fa fa-chevron-down pull-right"></i></div>
											</div>
											<div id="detail-c-<?php 
        echo $i;
        ?>
">
												<hr>
												<div id="<?php 
        echo clean_name($choice);
        ?>
" class="container"></div>
											</div>
										</li>
									</ul>

									<?php 
        $i++;
    }
    ?>
							</div>
						</div>
					</div>
				</div>
pagrindinis control scriptas
jam dodam parametrus o jis tada masto ka cia daryti 

*/
$RELPATH = '../';
include_once $RELPATH . 'site.ini.php';
include_once $RELPATH . $LIBPATH . 'header.inc.php';
if (empty($module)) {
    $module = '';
}
if (empty($table)) {
    $table = '';
}
$module = clean_name($module);
$table = clean_name($table);
// check if sent class really exists
if (!file_exists($RELPATH . $module . '/class/' . $table . '.class.php')) {
    redirect('/');
}
include_once $RELPATH . $module . '/class/' . $table . '.class.php';
$handler = new $table();
if (empty($pid)) {
    $pid = '';
    $g_tpl->set_var('back', '');
    $g_tpl->set_var('pid', '');
} else {
    $parent_module = $handler->parent_module ? $handler->parent_module : $module;
    $parent_name = $handler->parent;
    include_once $RELPATH . $parent_module . '/class/' . $parent_name . '.class.php';
    $parent = new $parent_name();
include_once $RELPATH . $LIBPATH . "util.lib.php";
if (isset($GLOBALS['bench'])) {
    echo "<br>checkpoint[includes]: " . round(getmicrotime() - $pradedam, 2);
}
$g_error = new avError('report');
if (isset($GLOBALS['bench'])) {
    echo "<br>checkpoint[error]: " . round(getmicrotime() - $pradedam, 2);
}
$g_ini = new avIni($RELPATH . 'global.ini.php');
if (isset($GLOBALS['bench'])) {
    echo "<br>checkpoint[ini]: " . round(getmicrotime() - $pradedam, 2);
}
if (empty($lang) || $lang != 'lt' && $lang != 'en') {
    $lang = $g_ini->read_var('site', 'Language');
}
$lang = clean_name($lang);
include_once $RELPATH . $LANGPATH . $lang . '.inc.php';
if (isset($GLOBALS['bench'])) {
    echo "<br>checkpoint[lang]: " . round(getmicrotime() - $pradedam, 2);
}
$g_db = new avDb();
if (isset($GLOBALS['bench'])) {
    echo "<br>checkpoint[db]: " . round(getmicrotime() - $pradedam, 2);
}
$g_sess = new avSession();
if (isset($GLOBALS['bench'])) {
    echo "<br>checkpoint[session]: " . round(getmicrotime() - $pradedam, 2);
}
$g_tpl = new phemplate($RELPATH, 'keep');
$g_tpl->set_error_handler(&$g_error);
$g_tpl->set_var('RELPATH', $RELPATH);
if (check_all($mail, $cn, $homephone, $mobile)) {
    $info = '';
    $info['objectclass'] = 'inetOrgPerson';
    /* sn es obligatorio, si no tiene, le ponemos cn */
    if ($sn == '') {
        $info['sn'] = clean_name($cn);
    } else {
        $info['sn'][0] = clean_name($sn);
    }
    /* givenName es obligatorio, si no tiene, le ponemos sn */
    if ($name == '') {
        $info['givenname'][0] = clean_name($sn);
    } else {
        $info['givenname'][0] = clean_name($name);
    }
    $my_cn = clean_name($cn);
    if ($my_cn != '') {
        $info['cn'][0] = $my_cn;
    }
    if ($postaladdress != '') {
        $info['postaladdress'][0] = $postaladdress;
    }
    if ($homephone != '') {
        $info['homephone'][0] = $homephone;
    }
    if ($mobile != '') {
        $info['mobile'][0] = $mobile;
    }
    if ($telephonenumber != '') {
        $info['telephonenumber'][0] = $telephonenumber;
    }
Exemple #10
0
function get_tree($path = '.', $clean_path = '', $title = '')
{
    $tree = array();
    $ignore = array('config.json', 'cgi-bin', '.', '..');
    $dh = @opendir($path);
    $index = 0;
    // Build array of paths
    $paths = array();
    while (false !== ($file = readdir($dh))) {
        $paths[$file] = $file;
    }
    // Close the directory handle
    closedir($dh);
    // Sort paths
    sort($paths);
    // Loop through the paths
    // while(false !== ($file = readdir($dh))){
    foreach ($paths as $file) {
        // Check that this file is not to be ignored
        if (!in_array($file, $ignore)) {
            $full_path = "{$path}/{$file}";
            $clean_sort = clean_sort($file);
            $url = $clean_path . '/' . $clean_sort;
            $clean_name = clean_name($clean_sort);
            // Title
            if (empty($title)) {
                $full_title = $clean_name;
            } else {
                $full_title = $title . ': ' . $clean_name;
            }
            if (is_dir("{$path}/{$file}")) {
                // Directory
                $tree[$clean_sort] = array('type' => 'folder', 'name' => $clean_name, 'title' => $full_title, 'path' => $full_path, 'clean' => $clean_sort, 'url' => $url, 'tree' => get_tree($full_path, $url, $full_title));
            } else {
                // File
                $tree[$clean_sort] = array('type' => 'file', 'name' => $clean_name, 'title' => $full_title, 'path' => $full_path, 'clean' => $clean_sort, 'url' => $url);
            }
        }
        $index++;
    }
    return $tree;
}
 function ppm_get_votes_shortcode()
 {
     function clean_name($var)
     {
         // strip out all whitespace
         $var = preg_replace('/\\s+/', '-', $var);
         // strip out all special chars
         $var = preg_replace('/[^A-Za-z0-9]/', '-', $var);
         // convert the string to all lowercase
         $var = strtolower($var);
         return $var;
     }
     global $wpdb;
     $table_name = $wpdb->prefix . 'ppm_votation';
     $results = $wpdb->get_results("SELECT * FROM {$table_name}", ARRAY_A);
     $creation_choices = get_field_object('field_5626c03dc0803');
     $creation_votes = [];
     foreach ($creation_choices['choices'] as $choice) {
         $creation_votes[clean_name($choice)] = [];
         foreach ($results as $voto) {
             $voto = (array) json_decode($voto['choices']);
             foreach ($voto as $i => $v) {
                 if (clean_name($choice) == $i) {
                     array_push($creation_votes[clean_name($choice)], $v);
                 }
             }
         }
     }
     echo '<h1>VOTOS PARA CRIAÇÃO</h1>';
     foreach ($creation_votes as $i => $creation_vote) {
         foreach ($creation_choices['choices'] as $choice_name) {
             if (clean_name($choice_name) == $i) {
                 echo '<h2>' . $choice_name . '</h2>';
             }
         }
         $array = array_count_values($creation_vote);
         arsort($array);
         if (!empty($array)) {
             foreach ($array as $vote => $number_of_votes) {
                 echo '<strong>' . $vote . '</strong>, obteve ' . $number_of_votes . ' votos.<br/>';
             }
         } else {
             echo '<strong>Nenhum voto nessa categoria.</strong><br/>';
         }
     }
     $production_choices = get_field_object('field_5626d2f421b80');
     $production_votes = [];
     foreach ($production_choices['choices'] as $choice) {
         $production_votes[clean_name($choice)] = [];
         foreach ($results as $voto) {
             $voto = (array) json_decode($voto['choices']);
             foreach ($voto as $i => $v) {
                 if (clean_name($choice) == $i) {
                     array_push($production_votes[clean_name($choice)], $v);
                 }
             }
         }
     }
     echo '<br/><br/><h1>VOTOS PARA PRODUÇÃO</h1>';
     foreach ($production_votes as $i => $production_vote) {
         foreach ($production_choices['choices'] as $choice_name) {
             if (clean_name($choice_name) == $i) {
                 echo '<h2>' . $choice_name . '</h2>';
             }
         }
         $array = array_count_values($production_vote);
         arsort($array);
         if (!empty($array)) {
             foreach ($array as $vote => $number_of_votes) {
                 echo '<strong>' . $vote . '</strong>, obteve ' . $number_of_votes . ' votos.<br/>';
             }
         } else {
             echo '<strong>Nenhum voto nessa categoria.</strong><br/>';
         }
     }
     $distribution_choices = get_field_object('field_5626d33421b81');
     $distribution_votes = [];
     foreach ($distribution_choices['choices'] as $choice) {
         $distribution_votes[clean_name($choice)] = [];
         foreach ($results as $voto) {
             $voto = (array) json_decode($voto['choices']);
             foreach ($voto as $i => $v) {
                 if (clean_name($choice) == $i) {
                     array_push($distribution_votes[clean_name($choice)], $v);
                 }
             }
         }
     }
     echo '<br/><br/><h1>VOTOS PARA CONVERGÊNCIA</h1>';
     foreach ($distribution_votes as $i => $distribution_vote) {
         foreach ($distribution_choices['choices'] as $choice_name) {
             if (clean_name($choice_name) == $i) {
                 echo '<h2>' . $choice_name . '</h2>';
             }
         }
         $array = array_count_values($distribution_vote);
         arsort($array);
         if (!empty($array)) {
             foreach ($array as $vote => $number_of_votes) {
                 echo '<strong>' . $vote . '</strong>, obteve ' . $number_of_votes . ' votos.<br/>';
             }
         } else {
             echo '<strong>Nenhum voto nessa categoria.</strong><br/>';
         }
     }
 }
 function pickup_submit()
 {
     avControl::pickup_submit();
     $name = '_f_new_' . $this->name;
     $change = 'change_file_' . $name;
     //		global $$name, ${"$name"."_name"}, ${"$name"."_size"};
     if (empty($GLOBALS[$change])) {
         return true;
     }
     $file = $GLOBALS[$name];
     if ($file == "none") {
         return true;
     }
     if (!$file) {
         return true;
     }
     if (!empty($this->value)) {
         unlink($this->dir . '/' . $this->value);
     }
     $file_name = $GLOBALS["{$name}" . "_name"];
     $file_size = $GLOBALS["{$name}" . "_size"];
     $file_name = clean_name($file_name);
     $dest = $this->dir . "/{$file_name}";
     if ($this->xsize && $this->ysize) {
         while (file_exists($dest . '.jpg')) {
             $file_name = "_" . $file_name;
             $dest = $this->dir . "/{$file_name}";
         }
         $this->resize_image_IM($file, $dest . '.jpg', $this->xsize, $this->ysize);
         $file_name = $file_name . '.jpg';
     } else {
         while (file_exists($dest)) {
             $file_name = "_" . $file_name;
             $dest = $this->dir . "/{$file_name}";
         }
         copy($file, $dest);
     }
     unlink($file);
     $this->value = $file_name;
 }
foreach (glob($input_folder . '/*.osm') as $input_file) {
    error_log("Looking at '{$input_file}'");
    $input_osm_ways = new OSMWays();
    $input_contents = file_get_contents($input_file) or die("Couldn't read file '{$osm_input}'");
    $input_osm_ways->deserialize_from_xml($input_contents);
    $code_map = array();
    $code_key = null;
    foreach ($input_osm_ways->ways as &$way) {
        $tags =& $way['tags'];
        if (empty($tags['name'])) {
            continue;
        }
        $names = explode('|', $tags['name_variants']);
        $main_name = $tags['name'];
        //iconv("utf-8", "us-ascii//TRANSLIT", $tags['name']);
        $main_name = clean_name($main_name);
        if (preg_match('@[^a-zA-Z.\\-\\/ \',()]@', $main_name)) {
            //            error_log("Foreign characters in main name: ".$main_name);
            $main_name = preg_replace('@[^a-zA-Z.\\-\\/ \',()]@', '', $main_name);
            //            error_log("Replaced with: ".$main_name);
        }
        $names[] = $main_name;
        $country_name = $tags['country_name'];
        $country_code = $tags['country_code'];
        $state_code = $tags['state_code'];
        $state_code_info[$state_code] = array('country_code' => $country_code);
        foreach ($names as $name) {
            if (empty($name)) {
                continue;
            }
            if (preg_match('@[^a-zA-Z.\\-\\/ \']@', $name)) {
 function event_work_submit()
 {
     global $url, $subject, $info, $work, $category, $thumbnail, $color, $g_user_id, $g_usr, $g_tpl;
     if (empty($subject)) {
         $this->error = 'reikia pavadinimo<br>';
     }
     if (empty($category)) {
         $this->error .= 'reikia kategorijos<br>';
     }
     $work = $_FILES['work'];
     if (empty($work) || 'none' == $work) {
         $this->error .= 'reikia atsiøsti darbà<br>';
     }
     if (!isset($g_user_id)) {
         $this->error .= 'reikia prisijungti prie sistemos<br>';
     }
     if ($error = $this->check_cannot_post()) {
         $this->error .= $error;
     }
     if ($this->error) {
         return true;
     }
     $work_name = $_FILES['work']['name'];
     $work_size = $_FILES['work']['size'];
     $work_types = array('gif', 'jpg', 'png', 'swf');
     $work_type = substr($work_name, strlen($work_name) - 3, 3);
     if (!in_array(strtolower($work_type), $work_types)) {
         $this->error .= 'blogas darbo failas, gali bûti tik .jpg, .gif, .png, .swf<br>';
     }
     if ($thumbnail != '' && $thumbnail != 'none') {
         $thumb_name = $_FILES['thumbnail']['name'];
         $thumb_size = $_FILES['thumbnail']['size'];
         $thumb_types = array('gif', 'jpg', 'png');
         $thumb_type = substr($thumb_name, strlen($thumb_name) - 3, 3);
         if (!in_array(strtolower($thumb_type), $thumb_types)) {
             $this->error .= 'blogas maþas paveiksliukas, gali bûti tik .jpg, .gif, .png<br>';
         }
     }
     if ($work_size < 10240) {
         $this->error .= 'per maþas darbo failas, limitas 10kb<br>';
     }
     if ($this->flash_category != $category && $work_size > 30720000) {
         $this->error .= 'per didelis darbo failas, limitas 300kb<br>';
     }
     if ($this->error) {
         return true;
     }
     // kopijuojam darba!
     $work_name = clean_name($work_name);
     $work_dest = $this->ini->read_var('avworks', 'works_dir') . $work_name;
     while (file_exists($work_dest)) {
         $work_name = "_" . $work_name;
         $work_dest = $this->ini->read_var('avworks', 'works_dir') . $work_name;
     }
     $work = $_FILES['work']['tmp_name'];
     copy($work, $work_dest);
     unlink($work);
     // gaminam thumbnaila
     // jei ok dedam atsiusta thumbnail
     if ($thumbnail != 'none') {
         // vadinam taip pat kaip darba, kad nereiktu tikrinti dublikatu
         $thumbnail = $_FILES['thumbnail']['tmp_name'];
         $thumb_dest = $this->ini->read_var('avworks', 'thumbnails_dir') . $work_name . '.jpg';
         $exec_src = $this->ini->read_var('avworks', 'convert_exec') . " -resize " . $this->thumb_x . "x" . $this->thumb_y . " {$thumbnail} jpg:{$thumb_dest}";
         exec($exec_src);
         $thumbnail_name = $work_name . '.jpg';
         if (!file_exists($thumb_dest)) {
             //galbut animuotas gifas? padarom pirma kadra
             if (file_exists($thumb_dest . '.0')) {
                 $this->error = '';
                 rename($thumb_dest . '.0', $thumb_dest);
             } else {
                 $this->error .= 'nepavyko padaryti maþo paveiksliuko<br>';
             }
         } else {
             $this->error = '';
         }
     }
     // jei problemos, gaminam is atsiusto darbo
     if (($thumbnail == 'none' || $this->error) && $category != $this->flash_category) {
         // vadinam taip pat kaip darba, kad nereiktu tikrinti dublikatu
         $thumb_dest = $this->ini->read_var('avworks', 'thumbnails_dir') . $work_name . '.jpg';
         $exec_src = $this->ini->read_var('avworks', 'convert_exec') . " -resize " . $this->thumb_x . "x" . $this->thumb_y . " {$work_dest} jpg:{$thumb_dest}";
         exec($exec_src);
         $thumbnail_name = $work_name . '.jpg';
         if (!file_exists($thumb_dest)) {
             //galbut animuotas gifas? padarom pirma kadra
             if (file_exists($thumb_dest . '.0')) {
                 $this->error = '';
                 rename($thumb_dest . '.0', $thumb_dest);
             } else {
                 $this->error .= 'nepavyko padaryti maþo paveiksliuko<br>';
             }
         } else {
             $this->error = '';
         }
     } elseif ($this->error) {
         $this->error .= 'nepavyko padaryti maþo paveiksliuko<br>';
     }
     // jei problemos, dedam default
     if ($this->error || empty($thumbnail_name)) {
         $thumbnail_name = 'nothumbnail.gif';
     }
     isset($color) || ($color = '');
     isset($info) || ($info = '');
     //wordwrap($comment, 30, " ", true) // senas variantas
     //smartWrap($text,30); // naujas variantas
     $info = smartWrap(do_ubb($info), 30);
     $subject = wordwrap(htmlchars($subject), 20, " ", true);
     // cia html'o nebus, todel standartinis wordwrap
     $color = clean_hex($color);
     $this->db->query("INSERT INTO avworks (subject, info, posted, thumbnail, file, submiter, category_id, color, file_size)\n\t\t\t\t\t\t\tVALUES ('{$subject}', '{$info}', NOW(), '{$thumbnail_name}', '{$work_name}', {$g_user_id}, {$category}, '{$color}', {$work_size})");
     // TODO: update avworks_stat
     $last_id = $this->db->get_insert_id();
     $this->db->query("insert into avworks_stat \n  (work_id, subject, info, posted, thumbnail, file, submiter, category_id, \n  views, color, file_size, submiter_name, category_name) \nselect w.id, w.subject, w.info, w.posted, w.thumbnail, w.file, w.submiter, w.category_id, \n  w.views, w.color, w.file_size, \n  u.username, c.name from avworks w, u_users u, avworkcategory c\nwhere w.submiter = u.id AND c.id = w.category_id AND w.id={$last_id}");
     $g_tpl->set_file('new_work', 'darbai/tpl/mail_new_work.txt');
     $g_tpl->set_var('id', $this->db->get_insert_id());
     $g_tpl->set_var('title', $subject);
     $g_tpl->set_var('username', $g_usr->username);
     $g_tpl->set_var('info', undo_ubb($info));
     $g_tpl->set_var('date', date('Y.m.d'));
     $this->db->clear_cache_tables('avworks');
     // $g_usr->mass_mail('art.scene naujas darbas', $g_tpl->process('temp', 'new_work'), 'mail_works');
     $this->result = true;
     return true;
 }
Exemple #15
0
<?php

if ($this->ion_auth->logged_in()) {
    $txt1 = array('id' => '0', 'text' => 'Find More Songs By ' . $song->song_artist, 'link' => base_url('search?q=' . clean_name($song->song_artist)), 'title' => 'Click Here', 'icon' => 'glyphicon-headphones', 'gTrack' => 'findbyartist-5-li');
    $txt2 = array('id' => '1', 'text' => 'Start A ' . $song->song_artist . ' Playlist', 'link' => base_url('playlist/artist/' . clean_name($song->song_artist)), 'title' => 'Start Listening', 'icon' => 'glyphicon-play', 'gTrack' => 'startplaylist-5-li');
    $txt = array($txt1, $txt2);
    shuffle($txt);
} else {
    $txt0 = array('id' => '2', 'text' => 'Create a playlists!', 'link' => base_url('auth/create_account'), 'title' => 'Sign Up', 'icon' => 'glyphicon-headphones', 'gTrack' => 'create-a-playlist');
    $txt1 = array('id' => '3', 'text' => 'Join for free. Sign up in seconds!', 'link' => base_url('auth/create_account'), 'title' => 'Sign Up', 'icon' => 'glyphicon-headphones', 'gTrack' => 'join-for-free');
    $txt2 = array('id' => '4', 'text' => 'Find More Songs By ' . $song->song_artist, 'link' => base_url('search/songs/' . clean_name($song->song_artist)), 'title' => 'Click Here', 'icon' => 'glyphicon-headphones', 'gTrack' => 'findbyartist-5');
    $txt3 = array('id' => '1', 'text' => 'Start A ' . $song->song_artist . ' Playlist', 'link' => base_url('playlist/artist/' . clean_name($song->song_artist)), 'title' => 'Start Listening', 'icon' => 'glyphicon-play', 'gTrack' => 'startplaylist-5-li');
    $txt = array($txt0, $txt1, $txt2, $txt3);
    shuffle($txt);
}
?>
	
<script type="text/javascript">
	$(document).ready(function(){
		if($('#msgBar').length) {
		var gBar = document.getElementById('msgBar');
        gBar.addEventListener('click', function(){
            ga('send', 'event', 'Ad', 'Click', 'Message Bar Button - <?php 
echo $txt[0]["gTrack"];
?>
', {'page': '<?php 
echo current_url();
?>
', 'advert': '<?php 
echo $txt[0]["gTrack"];
?>